Skip to content

Commit

Permalink
Document the new logic
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Oct 15, 2021
1 parent 3ea956b commit 38b9e6a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs
Expand Up @@ -301,6 +301,8 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
let mut options = member_constraint
.choice_regions
.iter()
// If any of the regions are inference vars, resolve them, as far
// as possible.
.filter_map(|option| match option {
ty::ReVar(vid) => match var_values.value(*vid) {
VarValue::ErrorValue => None,
Expand Down Expand Up @@ -644,6 +646,9 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
&& fr.sub_free_regions(self.tcx(), a, b)
};
if !choice_regions.clone().any(|choice_region| {
// This is really checking if the regions are equal. After member constraint
// resolution, one region must be equal, or a lifetime has been leaked into
// the hidden type, but does not appear in the corresponding impl trait.
sub(member_region, choice_region) && sub(choice_region, member_region)
}) {
let span = self.tcx().def_span(member_constraint.opaque_type_def_id);
Expand Down

0 comments on commit 38b9e6a

Please sign in to comment.