-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
DerefMut auto-deref error for union fields sometimes doesn't trigger #141621
Copy link
Copy link
Open
Labels
A-frontendArea: Compiler frontend (errors, parsing and HIR)Area: Compiler frontend (errors, parsing and HIR)C-bugCategory: This is a bug.Category: This is a bug.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.P-lang-drag-1Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-langLang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-langT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Metadata
Metadata
Assignees
Labels
A-frontendArea: Compiler frontend (errors, parsing and HIR)Area: Compiler frontend (errors, parsing and HIR)C-bugCategory: This is a bug.Category: This is a bug.I-lang-radarItems that are on lang's radar and will need eventual work or consideration.Items that are on lang's radar and will need eventual work or consideration.P-lang-drag-1Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-langLang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-langT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language team
Type
Fields
Give feedbackNo fields configured for issues without a type.
An implicit
DerefMutof aMaybeUninitunionfield is an error, but sometimes that error does not fire. This is not a soundness issue as it's more like a linthttps://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=3df4479c28c8a9ce5d2372e161c0e292
I expected to see this happen: Both assignments should error
Instead, this happened: Only the first produces an error
We ran into a similar case in rust-lang/rust-clippy#14387
https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=223c79eac2bb82ba9834354d2043d67f