Use try_normalize_erasing_regions in MIR validation#153327
Use try_normalize_erasing_regions in MIR validation#153327DukeDeSouth wants to merge 2 commits intorust-lang:mainfrom
Conversation
MIR validation calls `normalize_erasing_regions` to check field types and transmute sizing. This panics when the type involves opaque aliases wrapping error types from incomplete trait impls. Replace the four call sites with `try_normalize_erasing_regions`, falling back to the unnormalized type (or skipping the check) when normalization fails. This matches the pattern used in `elaborate_drop.rs` and `needs_drop.rs`. Fixes rust-lang#140303 Made-with: Cursor
|
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
|
r? @mati865 rustbot has assigned @mati865. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
This comment has been minimized.
This comment has been minimized.
Made-with: Cursor
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
Is this truly the right fix? Basically that means we have to make all MIR consumers robust against such non-normalizable types. There's a good reason for MIR validation to be strict here. We definitely shouldn't relax it without someone confirming/auditing MIR passes to ensure they can work with the new MIR this PR intends to declare valid. |
|
This github account's first PR was to openclaw. Then they opened 8 or so PRs to a similar number of entirely unrelated repos in one day. Hi. This is the moderation team of the Rust project. Your interaction with the Rust project has been identified as spammy, not constructive, or malicious. This goes against our Code of Conduct. We are thus banning you as per our policy. You can contact the moderation team to discuss and possibly reconsider your ban. |
|
Also the user was previously warned about vibe coded PRs: #152319 (comment) |
MIR validation calls normalize_erasing_regions in four places to check
field types on aggregates and sizing on transmutes. When the type
involves opaque aliases wrapping error types (e.g. from an incomplete
trait impl), normalization fails and the compiler panics.
Switched these four call sites to try_normalize_erasing_regions, falling
back to the unnormalized type or skipping the check. Same pattern used
in elaborate_drop and needs_drop elsewhere in the compiler.
Moved the crash test to a proper UI regression test.
Fixes #140303.
Made with Cursor