We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4ac9717 commit 68a1fdfCopy full SHA for 68a1fdf
src/librustc/infer/type_variable.rs
@@ -442,6 +442,11 @@ impl<'tcx> ut::UnifyValue for TypeVariableValue<'tcx> {
442
// If both sides are *unknown*, it hardly matters, does it?
443
(&TypeVariableValue::Unknown { universe: universe1 },
444
&TypeVariableValue::Unknown { universe: universe2 }) => {
445
+ // If we unify two unbound variables, ?T and ?U, then whatever
446
+ // value they wind up taking (which must be the same value) must
447
+ // be nameable by both universes. Therefore, the resulting
448
+ // universe is the minimum of the two universes, because that is
449
+ // the one which contains the fewest names in scope.
450
let universe = cmp::min(universe1, universe2);
451
Ok(TypeVariableValue::Unknown { universe })
452
}
0 commit comments