-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Fix precise field capture of univariant enums #97325
Conversation
When constructing a MIR from a THIR field expression, introduce an additional downcast projection before accessing a field of an enum. When rebasing a place builder on top of a captured place, account for the fact that a single HIR enum field projection corresponds to two MIR projection elements: a downcast element and a field element.
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
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.
🙏
@arora-aman can we consider your approval as a r+ or do you still want niko to review this? |
Thanks for review @arora-aman! @bors r=arora-aman |
📌 Commit 0e7eca7 has been approved by |
…-aman Fix precise field capture of univariant enums When constructing a MIR from a THIR field expression, introduce an additional downcast projection before accessing a field of an enum. When rebasing a place builder on top of a captured place, account for the fact that a single HIR enum field projection corresponds to two MIR projection elements: a downcast element and a field element. Fixes rust-lang#95271. Fixes rust-lang#96299. Fixes rust-lang#96512. Fixes rust-lang#97378. r? `@nikomatsakis` `@arora-aman`
Rollup of 5 pull requests Successful merges: - rust-lang#95948 (Improve the safety docs for `CStr`) - rust-lang#97325 (Fix precise field capture of univariant enums) - rust-lang#97817 (:arrow_up: rust-analyzer) - rust-lang#97821 (Remove confusing sentence from `Mutex` docs) - rust-lang#97826 (Add more information for rustdoc-gui tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
When constructing a MIR from a THIR field expression, introduce an
additional downcast projection before accessing a field of an enum.
When rebasing a place builder on top of a captured place, account for
the fact that a single HIR enum field projection corresponds to two MIR
projection elements: a downcast element and a field element.
Fixes #95271.
Fixes #96299.
Fixes #96512.
Fixes #97378.
r? @nikomatsakis @arora-aman