Skip to content

Commit 1eb5390

Browse files
committed
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 rust-lang#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.
1 parent 5716ae6 commit 1eb5390

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

compiler/rustc_borrowck/src/renumber.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,10 @@ impl RegionCtxt {
6969
/// Used to determine the representative of a component in the strongly connected
7070
/// constraint graph
7171
pub(crate) fn preference_value(self) -> usize {
72-
let _anon = Symbol::intern("anon");
73-
7472
match self {
7573
RegionCtxt::Unknown => 1,
7674
RegionCtxt::Existential(None) => 2,
77-
RegionCtxt::Existential(Some(_anon)) | RegionCtxt::Free(_anon) => 2,
75+
RegionCtxt::Existential(Some(_)) | RegionCtxt::Free(_) => 2,
7876
RegionCtxt::Location(_) => 3,
7977
RegionCtxt::TyContext(_) => 4,
8078
_ => 5,

0 commit comments

Comments
 (0)