Add a comment explaining unification w/ universes
This commit is contained in:
parent
4ac9717a1f
commit
68a1fdfee4
1 changed files with 5 additions and 0 deletions
|
@ -442,6 +442,11 @@ impl<'tcx> ut::UnifyValue for TypeVariableValue<'tcx> {
|
|||
// If both sides are *unknown*, it hardly matters, does it?
|
||||
(&TypeVariableValue::Unknown { universe: universe1 },
|
||||
&TypeVariableValue::Unknown { universe: universe2 }) => {
|
||||
// If we unify two unbound variables, ?T and ?U, then whatever
|
||||
// value they wind up taking (which must be the same value) must
|
||||
// be nameable by both universes. Therefore, the resulting
|
||||
// universe is the minimum of the two universes, because that is
|
||||
// the one which contains the fewest names in scope.
|
||||
let universe = cmp::min(universe1, universe2);
|
||||
Ok(TypeVariableValue::Unknown { universe })
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue