We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2bf4c79 commit 12b9040Copy full SHA for 12b9040
compiler/rustc_middle/src/infer/unify_key.rs
@@ -77,7 +77,14 @@ impl<'tcx> UnifyValue for RegionVariableValue<'tcx> {
77
(
78
RegionVariableValue::Unknown { universe: a },
79
RegionVariableValue::Unknown { universe: b },
80
- ) => Ok(RegionVariableValue::Unknown { universe: a.min(b) }),
+ ) => {
81
+ // If we unify two unconstrained regions then whatever
82
+ // value they wind up taking (which must be the same value) must
83
+ // be nameable by both universes. Therefore, the resulting
84
+ // universe is the minimum of the two universes, because that is
85
+ // the one which contains the fewest names in scope.
86
+ Ok(RegionVariableValue::Unknown { universe: a.min(b) })
87
+ }
88
}
89
90
0 commit comments