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

Use region-erased self type during IAT selection #109423

Merged

Conversation

fmease
Copy link
Member

@fmease fmease commented Mar 21, 2023

Split off from #109410 as discussed.
Fixes #109299.

Re UI test: I use a reproducer of #109299 that contains a name resolution error instead of reproducer regionck-2.rs (as found in the AliasKind::Inherent PR) since it would (incorrectly) pass compilation in this PR due to the lack of regionck and I'd rather not make that a regression test (with or without known-bug).

@rustbot label F-inherent_associated_types

r? @compiler-errors

@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. F-inherent_associated_types `#![feature(inherent_associated_types)]` labels Mar 21, 2023
@@ -2224,6 +2224,9 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
}
};

// Regions are not considered during selection.
let erased_self_ty = tcx.fold_regions(self_ty, |_, _| tcx.lifetimes.re_erased);
Copy link
Member

@compiler-errors compiler-errors Mar 21, 2023

Choose a reason for hiding this comment

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

I'm going back and forth whether we should use replace_escaping_bound_vars_uncached here instead...

If you don't want to use that, can you at least leave a FIXME saying that this only needs to deal w escaping bound vars (and not, e.g., early-bound regions), and it currently doesn't handle ty/const late-bound vars correctly?

@compiler-errors
Copy link
Member

r=me with nits dealt with either way, @bors delegate+

@bors
Copy link
Contributor

bors commented Mar 21, 2023

✌️ @fmease can now approve this pull request

@fmease fmease force-pushed the iat-selection-erase-regions-in-self-ty branch from 9d666eb to 293f21c Compare March 21, 2023 22:54
@fmease
Copy link
Member Author

fmease commented Mar 21, 2023

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Mar 21, 2023

📌 Commit 293f21c 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 Mar 21, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 21, 2023
…-in-self-ty, r=compiler-errors

Use region-erased self type during IAT selection

Split off from rust-lang#109410 as discussed.
Fixes rust-lang#109299.

Re UI test: I use a reproducer of rust-lang#109299 that contains a name resolution error instead of reproducer [`regionck-2.rs`](https://github.com/rust-lang/rust/blob/fc7ed4af165c27ab5914b93251194f826920cc65/tests/ui/associated-inherent-types/regionck-2.rs) (as found in the `AliasKind::Inherent` PR) since it would (incorrectly) pass typeck in this PR due to the lack of regionck and I'd rather not make *that* a regression test (with or without `known-bug`).

`@rustbot` label F-inherent_associated_types

r? `@compiler-errors`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 23, 2023
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#108954 (rustdoc: handle generics better when matching notable traits)
 - rust-lang#109203 (refactor/feat: refactor identifier parsing a bit)
 - rust-lang#109213 (Eagerly intern and check CrateNum/StableCrateId collisions)
 - rust-lang#109358 (rustc: Remove unused `Session` argument from some attribute functions)
 - rust-lang#109359 (Update stdarch)
 - rust-lang#109378 (Remove Ty::is_region_ptr)
 - rust-lang#109423 (Use region-erased self type during IAT selection)
 - rust-lang#109447 (new solver cleanup + implement coherence)
 - rust-lang#109501 (make link clickable)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit b22db3f into rust-lang:master Mar 23, 2023
@rustbot rustbot added this to the 1.70.0 milestone Mar 23, 2023
@fmease fmease deleted the iat-selection-erase-regions-in-self-ty branch March 23, 2023 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-inherent_associated_types `#![feature(inherent_associated_types)]` 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: ReError <= ReLateBound(DebruijnIndex(0), BoundRegion { .. }
4 participants