Skip to content

Commit 7a1ccf9

Browse files
committed
Avoid an ICE in the presence of HKL
1 parent ebf2772 commit 7a1ccf9

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
6666

6767
let mut subst_regions = vec![self.universal_regions.fr_static];
6868
let universal_substs = infcx.tcx.fold_regions(substs, &mut false, |region, _| {
69+
if let ty::RePlaceholder(..) = region {
70+
// Higher kinded regions don't need remapping, they don't refer to anything outside of this the substs.
71+
return region;
72+
}
6973
let vid = self.to_region_vid(region);
7074
trace!(?vid);
7175
let scc = self.constraint_sccs.scc(vid);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// check-pass
2+
3+
// this used to cause stack overflows
4+
5+
trait Hrtb<'a> {
6+
type Assoc;
7+
}
8+
9+
impl<'a> Hrtb<'a> for () {
10+
type Assoc = ();
11+
}
12+
13+
fn make_impl() -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {}
14+
15+
fn main() {}

0 commit comments

Comments
 (0)