From 377d8fa4e3057838f20dd1eb1669d4ebaf8a561a Mon Sep 17 00:00:00 2001 From: Boxy Date: Wed, 18 Jun 2025 15:04:03 +0100 Subject: Reviews --- compiler/rustc_type_ir/src/fast_reject.rs | 3 --- tests/ui/associated-inherent-types/bound_vars_in_args.rs | 4 ++-- tests/ui/associated-inherent-types/candidate-with-alias-2.rs | 3 +++ tests/ui/associated-inherent-types/candidate-with-alias-2.stderr | 6 +++--- tests/ui/associated-inherent-types/candidate-with-alias.rs | 3 +++ .../associated-inherent-types/multiple-candidates-in-adt-field-2.rs | 4 ++-- 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 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); 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: >::Inherent, | ^^^^^^^^ multiple `Inherent` found | note: candidate #1 is defined in an impl for the type `Foo<::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<::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); impl Foo { -- cgit 1.4.1-3-g733a5