diff options
| author | Boxy <rust@boxyuwu.dev> | 2025-06-18 15:04:03 +0100 |
|---|---|---|
| committer | Boxy <rust@boxyuwu.dev> | 2025-06-18 17:51:22 +0100 |
| commit | 377d8fa4e3057838f20dd1eb1669d4ebaf8a561a (patch) | |
| tree | 23bea03d31142b1315a8267da7eddf1f186b5a07 | |
| parent | ae65625252df45569940336bea6df8fe0c4826e6 (diff) | |
| download | rust-377d8fa4e3057838f20dd1eb1669d4ebaf8a561a.tar.gz rust-377d8fa4e3057838f20dd1eb1669d4ebaf8a561a.zip | |
Reviews
6 files changed, 13 insertions, 10 deletions
diff --git a/compiler/rustc_type_ir/src/fast_reject.rs b/compiler/rustc_type_ir/src/fast_reject.rs index a5d461c57cd..d88c88fc6f3 100644 --- a/compiler/rustc_type_ir/src/fast_reject.rs +++ b/compiler/rustc_type_ir/src/fast_reject.rs @@ -241,9 +241,6 @@ impl<I: Interner, const INSTANTIATE_LHS_WITH_INFER: bool, const INSTANTIATE_RHS_ } pub fn types_may_unify_with_depth(self, lhs: I::Ty, rhs: I::Ty, depth_limit: usize) -> bool { - if lhs == rhs { - return true; - } self.types_may_unify_inner(lhs, rhs, depth_limit) } diff --git a/tests/ui/associated-inherent-types/bound_vars_in_args.rs b/tests/ui/associated-inherent-types/bound_vars_in_args.rs index 0baa242af76..49a9ef31cd6 100644 --- a/tests/ui/associated-inherent-types/bound_vars_in_args.rs +++ b/tests/ui/associated-inherent-types/bound_vars_in_args.rs @@ -1,8 +1,8 @@ #![feature(non_lifetime_binders, inherent_associated_types)] #![expect(incomplete_features)] -// Test that we can resolve to the right IAT when the self type -// contains a bound type. +// Test whether we can resolve to the right IAT when the self type +// contains a bound type. This should ideally use the second impl. struct Foo<T: ?Sized>(T); diff --git a/tests/ui/associated-inherent-types/candidate-with-alias-2.rs b/tests/ui/associated-inherent-types/candidate-with-alias-2.rs index d7be825a9c2..551d30a8786 100644 --- a/tests/ui/associated-inherent-types/candidate-with-alias-2.rs +++ b/tests/ui/associated-inherent-types/candidate-with-alias-2.rs @@ -1,6 +1,9 @@ #![feature(inherent_associated_types)] #![expect(incomplete_features)] +// A behaviour test showcasing that we do not normalize associated types in +// the impl self ty when assembling IAT candidates + trait Identity { type Assoc; } diff --git a/tests/ui/associated-inherent-types/candidate-with-alias-2.stderr b/tests/ui/associated-inherent-types/candidate-with-alias-2.stderr index 335e35a9577..2b79b65f22b 100644 --- a/tests/ui/associated-inherent-types/candidate-with-alias-2.stderr +++ b/tests/ui/associated-inherent-types/candidate-with-alias-2.stderr @@ -1,16 +1,16 @@ error[E0034]: multiple applicable items in scope - --> $DIR/candidate-with-alias-2.rs:20:23 + --> $DIR/candidate-with-alias-2.rs:23:23 | LL | field: <Foo<u8>>::Inherent, | ^^^^^^^^ multiple `Inherent` found | note: candidate #1 is defined in an impl for the type `Foo<<u8 as Identity>::Assoc>` - --> $DIR/candidate-with-alias-2.rs:13:5 + --> $DIR/candidate-with-alias-2.rs:16:5 | LL | type Inherent = u8; | ^^^^^^^^^^^^^ note: candidate #2 is defined in an impl for the type `Foo<<u16 as Identity>::Assoc>` - --> $DIR/candidate-with-alias-2.rs:16:5 + --> $DIR/candidate-with-alias-2.rs:19:5 | LL | type Inherent = u32; | ^^^^^^^^^^^^^ diff --git a/tests/ui/associated-inherent-types/candidate-with-alias.rs b/tests/ui/associated-inherent-types/candidate-with-alias.rs index d4dd002a774..a84da195c26 100644 --- a/tests/ui/associated-inherent-types/candidate-with-alias.rs +++ b/tests/ui/associated-inherent-types/candidate-with-alias.rs @@ -3,6 +3,9 @@ #![feature(inherent_associated_types)] #![expect(incomplete_features)] +// A behaviour test showcasing that IAT resolution can pick the right +// candidate even if it has an alias, if it's the only candidate. + trait Identity { type Assoc; } diff --git a/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-2.rs b/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-2.rs index b942c303d3e..8a6d1896f7d 100644 --- a/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-2.rs +++ b/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-2.rs @@ -1,8 +1,8 @@ #![feature(inherent_associated_types)] #![expect(incomplete_features)] -// Test that when we have an unnormalized projection we don't normalize it -// to determine which IAT to resolve to. +// Test that when we have an unnormalized projection in the IAT self ty +// we don't normalize it to determine which IAT to resolve to. struct Foo<T>(T); impl Foo<u8> { |
