-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
avoid an ICE in ptr_as_ptr
when getting the def_id of a local
#12617
Conversation
= note: `-D clippy::ptr-as-ptr` implied by `-D warnings` | ||
= help: to override `-D warnings` add `#[allow(clippy::ptr_as_ptr)]` | ||
|
||
error: `as` casting between raw pointers without changing its mutability |
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.
the duplicate diagnostic issue here is tracked over at #12379
Nice, thanks! @bors r+ Could be good to rename |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Not sure if it deserves beta backporting considering it's been on beta for a while and even hit stable. I'm honestly surprised we didn't get a report for that ICE earlier, this seems like a somewhat easy ICE to run into? Can't hurt to nominate I guess |
…ulacrum [beta] Clippy backport r? `@Mark-Simulacrum` Backports: - rust-lang/rust-clippy#12486 - rust-lang/rust-clippy#12572 - rust-lang/rust-clippy#12508 - rust-lang/rust-clippy#12617 The first one is a bit bigger as usual for a backport. But it fixes a major issue with this lint that we overlooked. So I think this is worth it. After that was merged into nightly, there were no new issues opened about this lint, so IMO this is safe to backport to `beta` and put into stable.
Fixes #12616
Res::def_id
can panic, so avoid calling it in favor ofopt_def_id
, so we can gracefully handle resolutions that don't have aDefId
(e.g. local variables) and get a false negative in the worst case, rather than an ICEchangelog: Fix ICE in [
ptr_as_ptr
] when the cast expression is a function call to a local variable