Rollup merge of #93227 - compiler-errors:gat-hrtb-wfcheck, r=jackh726

Liberate late bound regions when collecting GAT substs in wfcheck

The issue here is that the [`GATSubstCollector`](https://github.com/rust-lang/rust/blob/master/compiler/rustc_typeck/src/check/wfcheck.rs#L604) does not currently do anything wrt `Binder`s, so the GAT substs it copies out have escaping late bound regions when it walks through types like `for<'x> fn() -> Self::Gat<'x>`.

I made that visitor call `liberate_late_bound_regions`, not sure if that's the right thing here or we need to do something else to replace these bound vars with placeholders. I'm not familiar with other code doing anything similar.. But the issue is indeed no longer ICEing.

Fixes #92954

r? `@jackh726`
since you last touched this code, feel free to reassign
This commit is contained in:
Matthias Krüger 2022-01-23 20:13:06 +01:00 committed by GitHub
commit 8810af8082
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 3 deletions

View file

@ -0,0 +1,10 @@
// check-pass
#![feature(generic_associated_types)]
pub trait Foo {
type Assoc<'c>;
fn function() -> for<'x> fn(Self::Assoc<'x>);
}
fn main() {}