Skip to content

Don't check unsize goal in MIR validation when opaques remain - #130989

Merged
bors merged 1 commit into
rust-lang:masterfrom
compiler-errors:unsize-opaque
Oct 16, 2024
Merged

Don't check unsize goal in MIR validation when opaques remain#130989
bors merged 1 commit into
rust-lang:masterfrom
compiler-errors:unsize-opaque

Conversation

@compiler-errors

Copy link
Copy Markdown
Contributor

Similarly to mir_assign_valid_types, let's just skip when there are opaques. Fixes#130921.

@rustbot

Copy link
Copy Markdown
Collaborator

r? @wesleywiser

rustbot has assigned @wesleywiser.
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

@rustbotrustbot 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 Sep 28, 2024
@rustbot

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Comment threadtests/ui/impl-trait/unsize-cast-validation-rpit.rs
@compiler-errors

Copy link
Copy Markdown
ContributorAuthor

It has been two weeks, so I'm gonna re-roll

r? compiler

@rustbotrustbot assigned estebank and unassigned wesleywiserOct 9, 2024
Comment on lines +600 to +604
// We sometimes have to use `defining_opaque_types` for predicates
// to succeed here and figuring out how exactly that should work
// is annoying. It is harmless enough to just not validate anything
// in that case. We still check this after analysis as all opaque
// types have been revealed at this point.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we not enforce this in some way?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't enforce it anyways for mir_assign_valid_types, so I don't see any reason to do so. I also don't think it would be easy to do.

Comment on lines +605 to +607
if pred.has_opaque_types() {
return true;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm slightly concerned because we use predicate_must_hold_modulo_regions in several places that don't necessarily have additional later checks. Are there negative tests where we can cause compilation failures even when triggering this code-path?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember that this is just validation I added, and we validate MIR after opaques are revealed. I'm not totally certain if I understand the concern here.

@estebank

Copy link
Copy Markdown
Contributor

r=me, with answers to the above, one way or another.

@compiler-errors

Copy link
Copy Markdown
ContributorAuthor

This is a fix for validation that I just added, so I'm not too worried that the check is now relaxed, since fully validating pre-revealed opaque MIR is not really possible to do.

@bors r=estebank rollup

@bors

bors commented Oct 10, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit 4af6137 has been approved by estebank

It is now in the queue for this repository.

@borsbors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 10, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 10, 2024
…stebank
Don't check unsize goal in MIR validation when opaques remain
Similarly to `mir_assign_valid_types`, let's just skip when there are opaques. Fixesrust-lang#130921.
@matthiaskrgr

Copy link
Copy Markdown
Member

needs a git rm tests/crashes/130921.rs I think
#131500 (comment)

workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Oct 10, 2024
…stebank
Don't check unsize goal in MIR validation when opaques remain
Similarly to `mir_assign_valid_types`, let's just skip when there are opaques. Fixesrust-lang#130921.
@matthiaskrgr

Copy link
Copy Markdown
Member

@bors r-

@borsbors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Oct 10, 2024
@compiler-errors

Copy link
Copy Markdown
ContributorAuthor

@bors r=estebank

@bors

bors commented Oct 16, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit c773098 has been approved by estebank

It is now in the queue for this repository.

@borsbors removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Oct 16, 2024
@borsbors added the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Oct 16, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 16, 2024
…stebank
Don't check unsize goal in MIR validation when opaques remain
Similarly to `mir_assign_valid_types`, let's just skip when there are opaques. Fixesrust-lang#130921.
Urgau added a commit to Urgau/rust that referenced this pull request Oct 16, 2024
…stebank
Don't check unsize goal in MIR validation when opaques remain
Similarly to `mir_assign_valid_types`, let's just skip when there are opaques. Fixesrust-lang#130921.
@UrgauUrgau mentioned this pull request Oct 16, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 16, 2024
Rollup of 10 pull requests
Successful merges:
- rust-lang#129181 (Pass end position of span through inline ASM cookie)
- rust-lang#130989 (Don't check unsize goal in MIR validation when opaques remain)
- rust-lang#131657 (Rustfmt `for<'a> async` correctly)
- rust-lang#131691 (Delay ambiguous intra-doc link resolution after `Cache` has been populated)
- rust-lang#131730 (Refactor some `core::fmt` macros)
- rust-lang#131751 (Rename `can_coerce` to `may_coerce`, and then structurally resolve correctly in the probe)
- rust-lang#131753 (Unify `secondary_span` and `swap_secondary_and_primary` args in `note_type_err`)
- rust-lang#131776 (Emscripten: Xfail backtrace ui tests)
- rust-lang#131777 (Fix trivially_copy_pass_by_ref in stable_mir)
- rust-lang#131778 (Fix needless_lifetimes in stable_mir)
r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 16, 2024
…iaskrgr
Rollup of 9 pull requests
Successful merges:
- rust-lang#130989 (Don't check unsize goal in MIR validation when opaques remain)
- rust-lang#131657 (Rustfmt `for<'a> async` correctly)
- rust-lang#131691 (Delay ambiguous intra-doc link resolution after `Cache` has been populated)
- rust-lang#131730 (Refactor some `core::fmt` macros)
- rust-lang#131751 (Rename `can_coerce` to `may_coerce`, and then structurally resolve correctly in the probe)
- rust-lang#131753 (Unify `secondary_span` and `swap_secondary_and_primary` args in `note_type_err`)
- rust-lang#131776 (Emscripten: Xfail backtrace ui tests)
- rust-lang#131777 (Fix trivially_copy_pass_by_ref in stable_mir)
- rust-lang#131778 (Fix needless_lifetimes in stable_mir)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors
bors merged commit b6a085a into rust-lang:masterOct 16, 2024
@rustbotrustbot added this to the 1.84.0 milestone Oct 16, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Oct 16, 2024
Rollup merge of rust-lang#130989 - compiler-errors:unsize-opaque, r=estebank
Don't check unsize goal in MIR validation when opaques remain
Similarly to `mir_assign_valid_types`, let's just skip when there are opaques. Fixesrust-lang#130921.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE: broken mir: Unsize coercion, but &Foo<[impl Sized; 2]> isn't coercible to &Foo<[i32]>

7 participants

@compiler-errors@rustbot@estebank@bors@matthiaskrgr@fmease@wesleywiser