Skip to content

Commit 12b9040

Browse files
committed
add comment
1 parent 2bf4c79 commit 12b9040

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
@@ -77,7 +77,14 @@ impl<'tcx> UnifyValue for RegionVariableValue<'tcx> {
7777
(
7878
RegionVariableValue::Unknown { universe: a },
7979
RegionVariableValue::Unknown { universe: b },
80-
) => Ok(RegionVariableValue::Unknown { universe: a.min(b) }),
80+
) => {
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+
}
8188
}
8289
}
8390
}

0 commit comments

Comments
 (0)