avoid an ICE in ptr_as_ptr when getting the def_id of a local#12617
Merged
bors merged 1 commit intorust-lang:masterfrom Apr 2, 2024
Merged
avoid an ICE in ptr_as_ptr when getting the def_id of a local#12617bors merged 1 commit intorust-lang:masterfrom
ptr_as_ptr when getting the def_id of a local#12617bors merged 1 commit intorust-lang:masterfrom
Conversation
Collaborator
y21
commented
Apr 2, 2024
| = 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 |
Member
Author
There was a problem hiding this comment.
the duplicate diagnostic issue here is tracked over at #12379
Alexendoo
approved these changes
Apr 2, 2024
Member
|
Nice, thanks! @bors r+ Could be good to rename |
Contributor
Contributor
Contributor
|
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
Member
Author
|
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 |
Member
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Apr 27, 2024
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #12616
Res::def_idcan 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