Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
lcnr committed Feb 22, 2024
1 parent 2bf4c79 commit 12b9040
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion compiler/rustc_middle/src/infer/unify_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,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) })
}
}
}
}
Expand Down

0 comments on commit 12b9040

Please sign in to comment.