-
Notifications
You must be signed in to change notification settings - Fork 1.7k
needless_borrow
: do not contradict dangerous_implicit_autorefs
#14810
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
Conversation
@Urgau |
39ee603
to
969e514
Compare
@rustbot note Beta nomination for 1.88 The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! ❤️ Just what I assume is a typo.
clippy_lints/src/dereference.rs
Outdated
@@ -997,6 +997,15 @@ fn report<'tcx>( | |||
); | |||
}, | |||
State::DerefedBorrow(state) => { | |||
// Do not suggest removing a non-mandatory `&` in `&*rawptr` in an `unside` context, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably a "unsafe" typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, fixed!
Rust 1.88 introduces the `dangerous_implicit_autorefs` lint which warns about using implicit autorefs on a place obtained from a raw pointer, as this may create aliasing issues. Prevent `clippy::needless_borrow` from triggering in this case, by disabling the lint when taking a reference on a raw pointer dereference. There might be a better way for doing this in the long run with a finer way of distinguish the problematic cases, but this will prevent Clippy from contradicting the compiler in the meantime.
969e514
to
0a059d9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks! ❤️
Rust 1.88 introduces the
dangerous_implicit_autorefs
lint which warns about using implicit autorefs on a place obtained from a raw pointer, as this may create aliasing issues.Prevent
clippy::needless_borrow
from triggering in this case, by disabling the lint when taking a reference on a raw pointer dereference. There might be a better way for doing this in the long run with a finer way of distinguish the problematic cases, but this will prevent Clippy from contradicting the compiler in the meantime.Fixes #14743
changelog: [
needless_borrow
]: do not contradict the compiler'sdangerous_implicit_autorefs
lint even though the refererences are not mandatory@rustbot label +beta-nominated
Summary Notes
Generated by triagebot, see help for how to add more