We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent db950ef commit 16350d7Copy full SHA for 16350d7
compiler/rustc_middle/src/infer/unify_key.rs
@@ -75,7 +75,14 @@ impl<'tcx> UnifyValue for RegionVariableValue<'tcx> {
75
(
76
RegionVariableValue::Unknown { universe: a },
77
RegionVariableValue::Unknown { universe: b },
78
- ) => Ok(RegionVariableValue::Unknown { universe: a.min(b) }),
+ ) => {
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
+ }
86
}
87
88
0 commit comments