Avoid an ICE in the presence of HKL

This commit is contained in:
Oli Scherer 2022-02-01 15:09:06 +00:00
parent ebf2772c58
commit 7a1ccf9a03
2 changed files with 19 additions and 0 deletions

View File

@ -66,6 +66,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
let mut subst_regions = vec![self.universal_regions.fr_static];
let universal_substs = infcx.tcx.fold_regions(substs, &mut false, |region, _| {
if let ty::RePlaceholder(..) = region {
// Higher kinded regions don't need remapping, they don't refer to anything outside of this the substs.
return region;
}
let vid = self.to_region_vid(region);
trace!(?vid);
let scc = self.constraint_sccs.scc(vid);

View File

@ -0,0 +1,15 @@
// check-pass
// this used to cause stack overflows
trait Hrtb<'a> {
type Assoc;
}
impl<'a> Hrtb<'a> for () {
type Assoc = ();
}
fn make_impl() -> impl for<'a> Hrtb<'a, Assoc = impl Send + 'a> {}
fn main() {}