Skip to content
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

iat selection: normalize self ty & completely erase bound vars #112493

Merged
merged 1 commit into from
Jun 11, 2023

Conversation

fmease
Copy link
Member

@fmease fmease commented Jun 10, 2023

Erase bound vars (most notably late-bound regions) irrespective of their binding level instead of just at the innermost one.
Fixes #111404.

@rustbot
Copy link
Collaborator

rustbot commented Jun 10, 2023

r? @TaKO8Ki

(rustbot has picked a reviewer for you, use r? to override)

@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 Jun 10, 2023
@fmease fmease force-pushed the iat-select-complete-bound-var-erasure branch from 65d6bc6 to 76558b7 Compare June 10, 2023 14:45
Copy link
Member

@compiler-errors compiler-errors left a comment

Choose a reason for hiding this comment

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

r=me with nits

match ct.kind() {
ty::ConstKind::Bound(_, bv) => self.tcx.mk_const(
ty::PlaceholderConst { universe: self.universe, bound: bv },
ct.ty(),
Copy link
Member

Choose a reason for hiding this comment

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

can you assert somewhere that the ct ty has no escaping bound vars?

@@ -2465,30 +2467,60 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {

let mut fulfillment_errors = Vec::new();
Copy link
Member

Choose a reason for hiding this comment

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

also kinda unrelated but do you mind, at the top of lookup_inherent_assoc_ty, asserting that tcx.features().inherent_associated_types or whatever, just so we make sure to never enter this code unless that feature is active? 😅

}

// FIXME(non_lifetime_binders): Here we are "truncating" or "flattening" the
// universe of placeholders. Is that correct during selection?
Copy link
Member

Choose a reason for hiding this comment

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

it's probably fine here (for now)

@fmease fmease force-pushed the iat-select-complete-bound-var-erasure branch from 76558b7 to a995255 Compare June 10, 2023 22:20
@@ -2442,6 +2444,11 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
return Ok(None);
}

if !tcx.features().inherent_associated_types {
tcx.sess
.delay_span_bug(span, "found inherent assoc type without the feature being gated");
Copy link
Member Author

@fmease fmease Jun 10, 2023

Choose a reason for hiding this comment

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

Not using assert! or similar as we'd ice when sb. defined & used an IAT w/o enabling the feature.
Instead of delay_span_bug, I could exit early at the very start of the function but that would lead to "spurious" extra errors on IAT use-sites (ambiguous assoc ty) next to the feature gate error.

@compiler-errors
Copy link
Member

@bors r+ rollup (feature gated)

@bors
Copy link
Contributor

bors commented Jun 10, 2023

📌 Commit a995255 has been approved by compiler-errors

It is now in the queue for this repository.

@bors bors 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 Jun 10, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 11, 2023
…iaskrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#112475 (Fix issue for module name when surround the struct literal with parentheses)
 - rust-lang#112477 (Give more helpful progress messages in `Assemble`)
 - rust-lang#112484 (Fix ntdll linkage issues on Windows UWP platforms)
 - rust-lang#112492 (Migrate GUI colors test to original CSS color format)
 - rust-lang#112493 (iat selection: normalize self ty & completely erase bound vars)
 - rust-lang#112497 (abs_sub: fix typo 0[-:][+.]0)
 - rust-lang#112498 (Update links to Rust Reference in diagnostic)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e9666d4 into rust-lang:master Jun 11, 2023
@rustbot rustbot added this to the 1.72.0 milestone Jun 11, 2023
@fmease fmease deleted the iat-select-complete-bound-var-erasure branch June 11, 2023 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant 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: cannot relate bound region: ReLateBound(DebruijnIndex(2), BoundRegion { ... } <= ReErased
5 participants