Skip to content

Commit 16350d7

Browse files
committed
add comment
1 parent db950ef commit 16350d7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compiler/rustc_middle/src/infer/unify_key.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,14 @@ impl<'tcx> UnifyValue for RegionVariableValue<'tcx> {
7575
(
7676
RegionVariableValue::Unknown { universe: a },
7777
RegionVariableValue::Unknown { universe: b },
78-
) => Ok(RegionVariableValue::Unknown { universe: a.min(b) }),
78+
) => {
79+
// If we unify two unconstrained regions then whatever
80+
// value they wind up taking (which must be the same value) must
81+
// be nameable by both universes. Therefore, the resulting
82+
// universe is the minimum of the two universes, because that is
83+
// the one which contains the fewest names in scope.
84+
Ok(RegionVariableValue::Unknown { universe: a.min(b) })
85+
}
7986
}
8087
}
8188
}

0 commit comments

Comments
 (0)