Fix RegionCtxt::preference_value
.
There's a bad pattern matching confusion present in this function. `_anon` gets assigned to, and then `_anon` is used as an unbound variable in the pattern, which is unrelated to the first `_anon`. If the `_anon` didn't start with `_` the compiler would give warnings. This was introduced in #104239. I have rewritten the function to remove the confusion and preserve the existing behaviour. This seems safest, because the original intent is not clear.
This commit is contained in:
parent
5716ae6982
commit
1eb53902f3
1 changed files with 1 additions and 3 deletions
|
@ -69,12 +69,10 @@ impl RegionCtxt {
|
|||
/// Used to determine the representative of a component in the strongly connected
|
||||
/// constraint graph
|
||||
pub(crate) fn preference_value(self) -> usize {
|
||||
let _anon = Symbol::intern("anon");
|
||||
|
||||
match self {
|
||||
RegionCtxt::Unknown => 1,
|
||||
RegionCtxt::Existential(None) => 2,
|
||||
RegionCtxt::Existential(Some(_anon)) | RegionCtxt::Free(_anon) => 2,
|
||||
RegionCtxt::Existential(Some(_)) | RegionCtxt::Free(_) => 2,
|
||||
RegionCtxt::Location(_) => 3,
|
||||
RegionCtxt::TyContext(_) => 4,
|
||||
_ => 5,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue