Skip to content

Commit 38b9e6a

Browse files
committed
Document the new logic
1 parent 3ea956b commit 38b9e6a

File tree

1 file changed

+5
-0
lines changed
  • compiler/rustc_infer/src/infer/lexical_region_resolve

1 file changed

+5
-0
lines changed

compiler/rustc_infer/src/infer/lexical_region_resolve/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,8 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
301301
let mut options = member_constraint
302302
.choice_regions
303303
.iter()
304+
// If any of the regions are inference vars, resolve them, as far
305+
// as possible.
304306
.filter_map(|option| match option {
305307
ty::ReVar(vid) => match var_values.value(*vid) {
306308
VarValue::ErrorValue => None,
@@ -644,6 +646,9 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
644646
&& fr.sub_free_regions(self.tcx(), a, b)
645647
};
646648
if !choice_regions.clone().any(|choice_region| {
649+
// This is really checking if the regions are equal. After member constraint
650+
// resolution, one region must be equal, or a lifetime has been leaked into
651+
// the hidden type, but does not appear in the corresponding impl trait.
647652
sub(member_region, choice_region) && sub(choice_region, member_region)
648653
}) {
649654
let span = self.tcx().def_span(member_constraint.opaque_type_def_id);

0 commit comments

Comments
 (0)