Skip to content

Commit 07b8bbb

Browse files
committed
Equality of regions is not just on identity, but if both regions outlive each other
1 parent 6f71cab commit 07b8bbb

File tree

1 file changed

+9
-1
lines changed
  • compiler/rustc_infer/src/infer/lexical_region_resolve

1 file changed

+9
-1
lines changed

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

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,15 @@ impl<'cx, 'tcx> LexicalResolver<'cx, 'tcx> {
637637
.choice_regions
638638
.iter()
639639
.map(|&choice_region| var_data.normalize(self.tcx(), choice_region));
640-
if !choice_regions.clone().any(|choice_region| member_region == choice_region) {
640+
let fr = &self.region_rels.free_regions;
641+
let sub = |a, b| {
642+
fr.is_free_or_static(a)
643+
&& fr.is_free_or_static(b)
644+
&& fr.sub_free_regions(self.tcx(), a, b)
645+
};
646+
if !choice_regions.clone().any(|choice_region| {
647+
sub(member_region, choice_region) && sub(choice_region, member_region)
648+
}) {
641649
let span = self.tcx().def_span(member_constraint.opaque_type_def_id);
642650
errors.push(RegionResolutionError::MemberConstraintFailure {
643651
span,

0 commit comments

Comments
 (0)