exhaustive match on implied bounds regions

This commit is contained in:
Ali MJ Al-Nasrawy 2023-03-09 11:30:49 +03:00
parent 183bd97d07
commit 211fa45d18

View File

@ -136,21 +136,14 @@ fn add_outlives_bounds<I>(&mut self, outlives_bounds: I)
self.region_bound_pairs self.region_bound_pairs
.insert(ty::OutlivesPredicate(GenericKind::Alias(alias_b), r_a)); .insert(ty::OutlivesPredicate(GenericKind::Alias(alias_b), r_a));
} }
OutlivesBound::RegionSubRegion(r_a, r_b) => { OutlivesBound::RegionSubRegion(r_a, r_b) => match (*r_a, *r_b) {
// In principle, we could record (and take (
// advantage of) every relationship here, but ty::ReStatic | ty::ReEarlyBound(_) | ty::ReFree(_),
// we are also free not to -- it simply means ty::ReStatic | ty::ReEarlyBound(_) | ty::ReFree(_),
// strictly less that we can successfully type ) => self.region_relation.add(r_a, r_b),
// check. Right now we only look for things (ty::ReError(_), _) | (_, ty::ReError(_)) => {}
// relationships between free regions. (It may _ => bug!("add_outlives_bounds: unexpected regions"),
// also be that we should revise our inference },
// system to be more general and to make use
// of *every* relationship that arises here,
// but presently we do not.)
if r_a.is_free_or_static() && r_b.is_free() {
self.region_relation.add(r_a, r_b)
}
}
} }
} }
} }