Skip to content

Commit b20aa97

Browse files
committed
exhaustive match on implied bounds regions
1 parent 9cfb5f7 commit b20aa97

File tree

1 file changed

+8
-15
lines changed
  • compiler/rustc_infer/src/infer/outlives

1 file changed

+8
-15
lines changed

compiler/rustc_infer/src/infer/outlives/env.rs

+8-15
Original file line numberDiff line numberDiff line change
@@ -136,21 +136,14 @@ impl<'tcx> OutlivesEnvironmentBuilder<'tcx> {
136136
self.region_bound_pairs
137137
.insert(ty::OutlivesPredicate(GenericKind::Alias(alias_b), r_a));
138138
}
139-
OutlivesBound::RegionSubRegion(r_a, r_b) => {
140-
// In principle, we could record (and take
141-
// advantage of) every relationship here, but
142-
// we are also free not to -- it simply means
143-
// strictly less that we can successfully type
144-
// check. Right now we only look for things
145-
// relationships between free regions. (It may
146-
// also be that we should revise our inference
147-
// system to be more general and to make use
148-
// of *every* relationship that arises here,
149-
// but presently we do not.)
150-
if r_a.is_free_or_static() && r_b.is_free() {
151-
self.region_relation.add(r_a, r_b)
152-
}
153-
}
139+
OutlivesBound::RegionSubRegion(r_a, r_b) => match (*r_a, *r_b) {
140+
(
141+
ty::ReStatic | ty::ReEarlyBound(_) | ty::ReFree(_),
142+
ty::ReStatic | ty::ReEarlyBound(_) | ty::ReFree(_),
143+
) => self.region_relation.add(r_a, r_b),
144+
(ty::ReError(_), _) | (_, ty::ReError(_)) => {}
145+
_ => bug!("add_outlives_bounds: unexpected regions"),
146+
},
154147
}
155148
}
156149
}

0 commit comments

Comments
 (0)