Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not_unsafe_ptr_arg_deref does not trigger on type aliases and trait methods #8092

Open
Tracked by #79
SeeSpring opened this issue Dec 7, 2021 · 1 comment
Open
Tracked by #79
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't

Comments

@SeeSpring
Copy link
Contributor

Summary

If the raw pointer is used behind a type alias or the function is part of a trait, not_unsafe_ptr_arg_deref is not triggered.

Lint Name

not_unsafe_ptr_arg_deref

Reproducer

I tried this code:

trait Bad {
    fn f(x: *const u8) -> u8 {
        unsafe { *x }
    }
}

type Alias = *const u8;
pub fn bad(x: Alias) -> u8 {
    unsafe { *x }
}

pub fn main() {
    bad(0 as _);
}

Playground

I expected to see this happen: Lint for not_unsafe_ptr_arg_deref is triggered

Instead, this happened: Lint is not triggered

Version

No response

@SeeSpring SeeSpring added C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't labels Dec 7, 2021
@asquared31415
Copy link
Contributor

This was fixed in #8273

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-false-negative Issue: The lint should have been triggered on code, but wasn't
Projects
None yet
Development

No branches or pull requests

2 participants