Skip to content

mir: accept ambiguous unsize coercion validation results - #161156

Open
rabindra789 wants to merge 1 commit into
rust-lang:mainfrom
rabindra789:fix/mir-unsize-validation-cycle
Open

mir: accept ambiguous unsize coercion validation results#161156
rabindra789 wants to merge 1 commit into
rust-lang:mainfrom
rabindra789:fix/mir-unsize-validation-cycle

Conversation

@rabindra789

@rabindra789 rabindra789 commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #155538
MIR validator might ICE on unsize coercion after monomorphization because the obligation may fall into a cycle, but that doesn't make coercion invalid.
Modified the test report only definitive errors and accept cycle results also added a test for the ICE bug.

@rustbot

rustbot commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 16, 2026
@rustbot

rustbot commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

r? @chenyukang

rustbot has assigned @chenyukang.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 19 candidates

@rustbot

This comment has been minimized.

@rabindra789
rabindra789 force-pushed the fix/mir-unsize-validation-cycle branch from 66bc779 to 2b2270d Compare August 16, 2026 07:07
@rust-log-analyzer

This comment has been minimized.

@rabindra789
rabindra789 force-pushed the fix/mir-unsize-validation-cycle branch from 2b2270d to 570abd8 Compare August 16, 2026 07:29
@theemathas

This comment was marked as resolved.

@theemathas

theemathas commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

FYI, adding a method to the Trait trait in your check-pass test causes the code to have a post-mono error when building (as opposed to checking) it. At least it doesn't ICE though.

@rabindra789

Copy link
Copy Markdown
Contributor Author

FYI, adding a method to the Trait trait in your check-pass test causes the code to have a post-mono error when building (as opposed to checking) it.

Thanks for the extra detail. I will check the test with a trait method and reproduce the p-m error on my side

@theemathas

theemathas commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Anyway, this is T-types's "jurisdiction", so

r? types

@rustbot rustbot added the T-types Relevant to the types team, which will review and decide on the PR/issue. label Aug 16, 2026
@rustbot rustbot assigned oli-obk and unassigned chenyukang Aug 16, 2026
The MIR validator currently treats ambiguous and old-solver cycle results as definite failures when checking Unsize coercions. This can ICE on valid post-monomorphization MIR.

Only definite trait evaluation errors should make this validation fail; ambiguity and cycle results are deliberately accepted.

Add a regression test for the post-monomorphization cycle case.
@rabindra789
rabindra789 force-pushed the fix/mir-unsize-validation-cycle branch from 570abd8 to bd379de Compare August 16, 2026 09:13
@oli-obk

oli-obk commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

I will check the test with a trait method and reproduce the p-m error on my side

did you come to any conclusion? Is there sth relevant that could be tested?

@oli-obk oli-obk added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 18, 2026
@rabindra789

Copy link
Copy Markdown
Contributor Author

I will check the test with a trait method and reproduce the p-m error on my side

did you come to any conclusion? Is there sth relevant that could be tested?

Yaa i tested it with a full build on both base and the PR.
After the MIR validation passes the method case reaches to a different issue. While building the vtable with old solver it gives an E0275 overflow and with the next solver it hits an instance resolution ICE. So, i think this is a separate codegen issue.

@oli-obk oli-obk added the I-types-nominated Nominated for discussion during a types team meeting. label Aug 18, 2026
@rabindra789

Copy link
Copy Markdown
Contributor Author

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

I-types-nominated Nominated for discussion during a types team meeting. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-types Relevant to the types team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Post-mono cycle ICE with dyn and RPIT

6 participants