diff options
| author | lcnr <rust@lcnr.de> | 2024-02-22 12:35:59 +0100 |
|---|---|---|
| committer | lcnr <rust@lcnr.de> | 2024-02-22 18:54:51 +0100 |
| commit | 16350d76d86c8fc515253c7e64cc2b9791d86368 (patch) | |
| tree | a00a23cae72ef680476758b73b0576396e3c4c00 | |
| parent | db950efbc390331c2e4cb19cf9d4f042821cbb64 (diff) | |
add comment
| -rw-r--r-- | compiler/rustc_middle/src/infer/unify_key.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/infer/unify_key.rs b/compiler/rustc_middle/src/infer/unify_key.rs index 8d8ff48a79e..84b428297db 100644 --- a/compiler/rustc_middle/src/infer/unify_key.rs +++ b/compiler/rustc_middle/src/infer/unify_key.rs @@ -75,7 +75,14 @@ impl<'tcx> UnifyValue for RegionVariableValue<'tcx> { ( RegionVariableValue::Unknown { universe: a }, RegionVariableValue::Unknown { universe: b }, - ) => Ok(RegionVariableValue::Unknown { universe: a.min(b) }), + ) => { + // If we unify two unconstrained regions 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. + Ok(RegionVariableValue::Unknown { universe: a.min(b) }) + } } } } |
