about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorBoxy <rust@boxyuwu.dev>2025-04-24 10:49:06 +0100
committerBoxy <rust@boxyuwu.dev>2025-06-17 14:18:34 +0100
commit442862bc78b24f6019e4f3e32cfe2380dd480f26 (patch)
treeb03b8571e0ca2dd7f2ae77a682762755665ce91f /tests
parent55d436467c351b56253deeba209ae2553d1c243f (diff)
downloadrust-442862bc78b24f6019e4f3e32cfe2380dd480f26.tar.gz
rust-442862bc78b24f6019e4f3e32cfe2380dd480f26.zip
Don't build `ParamEnv` and do trait solving in `ItemCtxt`s
Diffstat (limited to 'tests')
-rw-r--r--tests/crashes/136678.rs18
-rw-r--r--tests/crashes/138131.rs9
-rw-r--r--tests/ui/associated-inherent-types/bound_vars_in_args.rs23
-rw-r--r--tests/ui/associated-inherent-types/bound_vars_in_args.stderr37
-rw-r--r--tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr33
-rw-r--r--tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.rs16
-rw-r--r--tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr37
-rw-r--r--tests/ui/associated-inherent-types/candidate-with-alias-2.rs26
-rw-r--r--tests/ui/associated-inherent-types/candidate-with-alias-2.stderr20
-rw-r--r--tests/ui/associated-inherent-types/candidate-with-alias.rs27
-rw-r--r--tests/ui/associated-inherent-types/iat-in-where-bound.rs14
-rw-r--r--tests/ui/associated-inherent-types/iat-inside-of-adt.rs (renamed from tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.rs)9
-rw-r--r--tests/ui/associated-inherent-types/inhabited-predicates.rs (renamed from tests/crashes/125879.rs)7
-rw-r--r--tests/ui/associated-inherent-types/inhabited-predicates.stderr27
-rw-r--r--tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-1.rs23
-rw-r--r--tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-2.rs29
-rw-r--r--tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-2.stderr20
-rw-r--r--tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-3.rs27
-rw-r--r--tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.rs2
-rw-r--r--tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr18
-rw-r--r--tests/ui/associated-inherent-types/really_deep_self_ty_mismatch.rs26
-rw-r--r--tests/ui/const-generics/mgca/unresolved-iac-1.rs11
-rw-r--r--tests/ui/const-generics/mgca/unresolved-iac-1.stderr16
-rw-r--r--tests/ui/const-generics/mgca/unresolved-iac-2.rs14
-rw-r--r--tests/ui/const-generics/mgca/unresolved-iac-2.stderr15
25 files changed, 382 insertions, 122 deletions
diff --git a/tests/crashes/136678.rs b/tests/crashes/136678.rs
deleted file mode 100644
index e7d7de23bfe..00000000000
--- a/tests/crashes/136678.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-//@ known-bug: #136678
-#![feature(inherent_associated_types)]
-#![feature(generic_const_exprs)]
-#![allow(incomplete_features)]
-
-struct B<const A: usize>;
-
-struct Test<const A: usize>;
-
-impl<const A: usize> Test<A> {
-    type B = B<{ A }>;
-
-    fn test(a: Self::B) -> Self::B {
-        a
-    }
-}
-
-pub fn main() {}
diff --git a/tests/crashes/138131.rs b/tests/crashes/138131.rs
index f400c02de8d..d0f91b74840 100644
--- a/tests/crashes/138131.rs
+++ b/tests/crashes/138131.rs
@@ -1,12 +1,15 @@
 //@ known-bug: #138131
-#![feature(min_generic_const_args)]
-#![feature(inherent_associated_types)]
+
+#![feature(min_generic_const_args, generic_const_items)]
+
+const BAR<'a>: usize = 10;
+
 struct Foo<'a> {
     x: &'a (),
 }
 
 impl<'a> Foo<'a> {
-    fn foo(_: [u8; Foo::X]) {}
+    fn foo(_: [u8; BAR]) {}
 }
 
 fn main() {}
diff --git a/tests/ui/associated-inherent-types/bound_vars_in_args.rs b/tests/ui/associated-inherent-types/bound_vars_in_args.rs
new file mode 100644
index 00000000000..276e3cf1da0
--- /dev/null
+++ b/tests/ui/associated-inherent-types/bound_vars_in_args.rs
@@ -0,0 +1,23 @@
+#![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.
+
+struct Foo<T: ?Sized>(T);
+
+impl Foo<[u8]> {
+    type IAT = u8;
+}
+
+impl<T: Sized> Foo<T> {
+    type IAT = u8;
+}
+
+struct Bar
+//~^ ERROR: the size for values of type `T` cannot be known at compilation time
+//~| ERROR: the size for values of type `T` cannot be known at compilation time
+where
+    for<T> Foo<T>::IAT: Sized;
+
+fn main() {}
diff --git a/tests/ui/associated-inherent-types/bound_vars_in_args.stderr b/tests/ui/associated-inherent-types/bound_vars_in_args.stderr
new file mode 100644
index 00000000000..108f1e531af
--- /dev/null
+++ b/tests/ui/associated-inherent-types/bound_vars_in_args.stderr
@@ -0,0 +1,37 @@
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+  --> $DIR/bound_vars_in_args.rs:17:1
+   |
+LL | struct Bar
+   | ^^^^^^^^^^ doesn't have a size known at compile-time
+   |
+   = help: the trait `Sized` is not implemented for `T`
+note: required by a bound in `Foo<T>::IAT`
+  --> $DIR/bound_vars_in_args.rs:13:9
+   |
+LL | impl<T: Sized> Foo<T> {
+   |         ^^^^^ required by this bound in `Foo<T>::IAT`
+LL |     type IAT = u8;
+   |          --- required by a bound in this associated type
+
+error[E0277]: the size for values of type `T` cannot be known at compilation time
+  --> $DIR/bound_vars_in_args.rs:17:1
+   |
+LL | / struct Bar
+LL | |
+LL | |
+LL | | where
+LL | |     for<T> Foo<T>::IAT: Sized;
+   | |______________________________^ doesn't have a size known at compile-time
+   |
+   = help: the trait `Sized` is not implemented for `T`
+note: required by a bound in `Foo<T>::IAT`
+  --> $DIR/bound_vars_in_args.rs:13:9
+   |
+LL | impl<T: Sized> Foo<T> {
+   |         ^^^^^ required by this bound in `Foo<T>::IAT`
+LL |     type IAT = u8;
+   |          --- required by a bound in this associated type
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr
deleted file mode 100644
index 7f8ed898525..00000000000
--- a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.stderr
+++ /dev/null
@@ -1,33 +0,0 @@
-error[E0391]: cycle detected when computing predicates of `Foo`
-  --> $DIR/cycle-iat-inside-of-adt.rs:7:1
-   |
-LL | struct Foo {
-   | ^^^^^^^^^^
-   |
-note: ...which requires computing inferred outlives-predicates of `Foo`...
-  --> $DIR/cycle-iat-inside-of-adt.rs:7:1
-   |
-LL | struct Foo {
-   | ^^^^^^^^^^
-   = note: ...which requires computing the inferred outlives-predicates for items in this crate...
-note: ...which requires computing type of `Foo::bar`...
-  --> $DIR/cycle-iat-inside-of-adt.rs:8:5
-   |
-LL |     bar: Self::Bar,
-   |     ^^^^^^^^^^^^^^
-note: ...which requires computing normalized predicates of `Foo`...
-  --> $DIR/cycle-iat-inside-of-adt.rs:7:1
-   |
-LL | struct Foo {
-   | ^^^^^^^^^^
-   = note: ...which again requires computing predicates of `Foo`, completing the cycle
-note: cycle used when checking that `Foo` is well-formed
-  --> $DIR/cycle-iat-inside-of-adt.rs:7:1
-   |
-LL | struct Foo {
-   | ^^^^^^^^^^
-   = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
-error: aborting due to 1 previous error
-
-For more information about this error, try `rustc --explain E0391`.
diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.rs b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.rs
deleted file mode 100644
index 902094b9862..00000000000
--- a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-//@ known-bug: unknown
-
-#![feature(inherent_associated_types)]
-#![allow(incomplete_features)]
-
-// FIXME(inherent_associated_types): This shouldn't lead to a cycle error.
-
-fn user<T>() where S<T>::P: std::fmt::Debug {}
-
-struct S<T>;
-
-impl<T: Copy> S<T> {
-    type P = ();
-}
-
-fn main() {}
diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr b/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr
deleted file mode 100644
index e97a5df9d49..00000000000
--- a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-where-predicate.stderr
+++ /dev/null
@@ -1,37 +0,0 @@
-error[E0391]: cycle detected when computing predicates of `user`
-  --> $DIR/cycle-iat-inside-of-where-predicate.rs:8:1
-   |
-LL | fn user<T>() where S<T>::P: std::fmt::Debug {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   |
-note: ...which requires computing explicit predicates of `user`...
-  --> $DIR/cycle-iat-inside-of-where-predicate.rs:8:1
-   |
-LL | fn user<T>() where S<T>::P: std::fmt::Debug {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-note: ...which requires computing normalized predicates of `user`...
-  --> $DIR/cycle-iat-inside-of-where-predicate.rs:8:1
-   |
-LL | fn user<T>() where S<T>::P: std::fmt::Debug {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: ...which again requires computing predicates of `user`, completing the cycle
-note: cycle used when checking that `user` is well-formed
-  --> $DIR/cycle-iat-inside-of-where-predicate.rs:8:1
-   |
-LL | fn user<T>() where S<T>::P: std::fmt::Debug {}
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   = note: see https://rustc-dev-guide.rust-lang.org/overview.html#queries and https://rustc-dev-guide.rust-lang.org/query.html for more information
-
-error[E0392]: type parameter `T` is never used
-  --> $DIR/cycle-iat-inside-of-where-predicate.rs:10:10
-   |
-LL | struct S<T>;
-   |          ^ unused type parameter
-   |
-   = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
-   = help: if you intended `T` to be a const parameter, use `const T: /* Type */` instead
-
-error: aborting due to 2 previous errors
-
-Some errors have detailed explanations: E0391, E0392.
-For more information about an error, try `rustc --explain E0391`.
diff --git a/tests/ui/associated-inherent-types/candidate-with-alias-2.rs b/tests/ui/associated-inherent-types/candidate-with-alias-2.rs
new file mode 100644
index 00000000000..d7be825a9c2
--- /dev/null
+++ b/tests/ui/associated-inherent-types/candidate-with-alias-2.rs
@@ -0,0 +1,26 @@
+#![feature(inherent_associated_types)]
+#![expect(incomplete_features)]
+
+trait Identity {
+    type Assoc;
+}
+impl<T> Identity for T {
+    type Assoc = T;
+}
+
+struct Foo<T>(T);
+impl Foo<<u8 as Identity>::Assoc> {
+    type Inherent = u8;
+}
+impl Foo<<u16 as Identity>::Assoc> {
+    type Inherent = u32;
+}
+
+struct Bar {
+    field: <Foo<u8>>::Inherent,
+    //~^ ERROR: multiple applicable items in scope
+}
+
+fn main() {
+    Bar { field: 10_u8 };
+}
diff --git a/tests/ui/associated-inherent-types/candidate-with-alias-2.stderr b/tests/ui/associated-inherent-types/candidate-with-alias-2.stderr
new file mode 100644
index 00000000000..335e35a9577
--- /dev/null
+++ b/tests/ui/associated-inherent-types/candidate-with-alias-2.stderr
@@ -0,0 +1,20 @@
+error[E0034]: multiple applicable items in scope
+  --> $DIR/candidate-with-alias-2.rs:20: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
+   |
+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
+   |
+LL |     type Inherent = u32;
+   |     ^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0034`.
diff --git a/tests/ui/associated-inherent-types/candidate-with-alias.rs b/tests/ui/associated-inherent-types/candidate-with-alias.rs
new file mode 100644
index 00000000000..d4dd002a774
--- /dev/null
+++ b/tests/ui/associated-inherent-types/candidate-with-alias.rs
@@ -0,0 +1,27 @@
+//@ check-pass
+
+#![feature(inherent_associated_types)]
+#![expect(incomplete_features)]
+
+trait Identity {
+    type Assoc;
+}
+impl<T> Identity for T {
+    type Assoc = T;
+}
+
+struct Foo<T>(T);
+impl Foo<<u8 as Identity>::Assoc> {
+    type Inherent = u8;
+}
+impl Foo<u16> {
+    type Inherent = u32;
+}
+
+struct Bar {
+    field: <Foo<u8>>::Inherent,
+}
+
+fn main() {
+    Bar { field: 10_u8 };
+}
diff --git a/tests/ui/associated-inherent-types/iat-in-where-bound.rs b/tests/ui/associated-inherent-types/iat-in-where-bound.rs
new file mode 100644
index 00000000000..3b8b95eec9a
--- /dev/null
+++ b/tests/ui/associated-inherent-types/iat-in-where-bound.rs
@@ -0,0 +1,14 @@
+//@ check-pass
+
+#![feature(inherent_associated_types)]
+#![allow(incomplete_features)]
+
+fn user<T: Copy>() where S<T>::P: std::fmt::Debug {}
+
+struct S<T>(T);
+
+impl<T: Copy> S<T> {
+    type P = ();
+}
+
+fn main() {}
diff --git a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.rs b/tests/ui/associated-inherent-types/iat-inside-of-adt.rs
index 64168cb8c14..3d88016d0f8 100644
--- a/tests/ui/associated-inherent-types/bugs/cycle-iat-inside-of-adt.rs
+++ b/tests/ui/associated-inherent-types/iat-inside-of-adt.rs
@@ -1,8 +1,7 @@
-//@ known-bug: #108491
+//@ check-pass
 
 #![feature(inherent_associated_types)]
 #![allow(incomplete_features)]
-// FIXME(inherent_associated_types): This should pass.
 
 struct Foo {
     bar: Self::Bar,
@@ -11,4 +10,8 @@ impl Foo {
     pub type Bar = usize;
 }
 
-fn main() {}
+fn main() {
+    Foo {
+        bar: 10_usize,
+    };
+}
diff --git a/tests/crashes/125879.rs b/tests/ui/associated-inherent-types/inhabited-predicates.rs
index 4318842e455..2b041d4e1be 100644
--- a/tests/crashes/125879.rs
+++ b/tests/ui/associated-inherent-types/inhabited-predicates.rs
@@ -1,8 +1,10 @@
-//@ known-bug: rust-lang/rust#125879
+//@ check-pass
+
 #![feature(inherent_associated_types)]
-#![allow(incomplete_features)]
+#![expect(incomplete_features)]
 
 pub type PubAlias0 = PubTy::PrivAssocTy;
+//~^ WARN: associated type `PubTy::PrivAssocTy` is more private than the item `PubAlias0`
 
 pub struct PubTy;
 impl PubTy {
@@ -10,6 +12,7 @@ impl PubTy {
 }
 
 pub struct S(pub PubAlias0);
+//~^ WARN: associated type `PubTy::PrivAssocTy` is more private than the item `S::0`
 
 pub unsafe fn foo(a: S) -> S {
     a
diff --git a/tests/ui/associated-inherent-types/inhabited-predicates.stderr b/tests/ui/associated-inherent-types/inhabited-predicates.stderr
new file mode 100644
index 00000000000..e43cd034e67
--- /dev/null
+++ b/tests/ui/associated-inherent-types/inhabited-predicates.stderr
@@ -0,0 +1,27 @@
+warning: associated type `PubTy::PrivAssocTy` is more private than the item `PubAlias0`
+  --> $DIR/inhabited-predicates.rs:6:1
+   |
+LL | pub type PubAlias0 = PubTy::PrivAssocTy;
+   | ^^^^^^^^^^^^^^^^^^ type alias `PubAlias0` is reachable at visibility `pub`
+   |
+note: but associated type `PubTy::PrivAssocTy` is only usable at visibility `pub(crate)`
+  --> $DIR/inhabited-predicates.rs:11:5
+   |
+LL |     type PrivAssocTy = ();
+   |     ^^^^^^^^^^^^^^^^
+   = note: `#[warn(private_interfaces)]` on by default
+
+warning: associated type `PubTy::PrivAssocTy` is more private than the item `S::0`
+  --> $DIR/inhabited-predicates.rs:14:14
+   |
+LL | pub struct S(pub PubAlias0);
+   |              ^^^^^^^^^^^^^ field `S::0` is reachable at visibility `pub`
+   |
+note: but associated type `PubTy::PrivAssocTy` is only usable at visibility `pub(crate)`
+  --> $DIR/inhabited-predicates.rs:11:5
+   |
+LL |     type PrivAssocTy = ();
+   |     ^^^^^^^^^^^^^^^^
+
+warning: 2 warnings emitted
+
diff --git a/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-1.rs b/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-1.rs
new file mode 100644
index 00000000000..7723ee9c58d
--- /dev/null
+++ b/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-1.rs
@@ -0,0 +1,23 @@
+//@ check-pass
+
+#![feature(inherent_associated_types)]
+#![expect(incomplete_features)]
+
+// Test that when resolving an IAT we select candidates based
+// off whether the self type matches not just the name of the IAT
+
+struct Foo<T>(T);
+impl Foo<u8> {
+    type Inherent = u8;
+}
+impl Foo<u16> {
+    type Inherent = u32;
+}
+
+struct Bar {
+    field: <Foo<u16>>::Inherent,
+}
+
+fn main() {
+    Bar { field: 10_u32 };
+}
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
new file mode 100644
index 00000000000..b942c303d3e
--- /dev/null
+++ b/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-2.rs
@@ -0,0 +1,29 @@
+#![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.
+
+struct Foo<T>(T);
+impl Foo<u8> {
+    type Inherent = u16;
+}
+impl Foo<u16> {
+    type Inherent = u32;
+}
+
+struct Bar {
+    field: <Foo<<u8 as Identity>::This>>::Inherent,
+    //~^ ERROR: multiple applicable items in scope
+}
+
+trait Identity {
+    type This;
+}
+impl<T> Identity for T { type This = T; }
+
+fn main() {
+    Bar {
+        field: 1_u16,
+    };
+}
diff --git a/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-2.stderr b/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-2.stderr
new file mode 100644
index 00000000000..df8c124f77f
--- /dev/null
+++ b/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-2.stderr
@@ -0,0 +1,20 @@
+error[E0034]: multiple applicable items in scope
+  --> $DIR/multiple-candidates-in-adt-field-2.rs:16:43
+   |
+LL |     field: <Foo<<u8 as Identity>::This>>::Inherent,
+   |                                           ^^^^^^^^ multiple `Inherent` found
+   |
+note: candidate #1 is defined in an impl for the type `Foo<u8>`
+  --> $DIR/multiple-candidates-in-adt-field-2.rs:9:5
+   |
+LL |     type Inherent = u16;
+   |     ^^^^^^^^^^^^^
+note: candidate #2 is defined in an impl for the type `Foo<u16>`
+  --> $DIR/multiple-candidates-in-adt-field-2.rs:12:5
+   |
+LL |     type Inherent = u32;
+   |     ^^^^^^^^^^^^^
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0034`.
diff --git a/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-3.rs b/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-3.rs
new file mode 100644
index 00000000000..4c5b382463d
--- /dev/null
+++ b/tests/ui/associated-inherent-types/multiple-candidates-in-adt-field-3.rs
@@ -0,0 +1,27 @@
+//@ check-pass
+
+#![feature(inherent_associated_types, lazy_type_alias)]
+#![expect(incomplete_features)]
+
+// Test that we *do* normalize free aliases in order to resolve
+// between multiple IAT candidates
+
+type Free = u8;
+
+struct Foo<T>(T);
+impl Foo<u8> {
+    type Assoc = u16;
+}
+impl Foo<u16> {
+    type Assoc = u32;
+}
+
+struct Bar {
+    field: <Foo<Free>>::Assoc,
+}
+
+fn main() {
+    Bar {
+        field: 1_u16,
+    };
+}
diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.rs b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.rs
index c205cb800d2..337fd8fa00c 100644
--- a/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.rs
+++ b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.rs
@@ -27,5 +27,5 @@ impl S<()> {
 fn main() {
     let _: S::<bool>::Pr = ();
     //[shadowed]~^ ERROR associated type `Pr` not found
-    //[uncovered]~^^ ERROR ambiguous associated type
+    //[uncovered]~^^ ERROR associated type `Pr` not found
 }
diff --git a/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr
index 3e914e0538d..f35158c5b41 100644
--- a/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr
+++ b/tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr
@@ -1,15 +1,15 @@
-error[E0223]: ambiguous associated type
-  --> $DIR/not-found-self-type-differs-shadowing-trait-item.rs:28:12
+error[E0220]: associated type `Pr` not found for `S<bool>` in the current scope
+  --> $DIR/not-found-self-type-differs-shadowing-trait-item.rs:28:23
    |
+LL | struct S<T>(T);
+   | ----------- associated type `Pr` not found for this struct
+...
 LL |     let _: S::<bool>::Pr = ();
-   |            ^^^^^^^^^^^^^
-   |
-help: use fully-qualified syntax
-   |
-LL -     let _: S::<bool>::Pr = ();
-LL +     let _: <S<bool> as Tr>::Pr = ();
+   |                       ^^ associated item not found in `S<bool>`
    |
+   = note: the associated type was found for
+           
 
 error: aborting due to 1 previous error
 
-For more information about this error, try `rustc --explain E0223`.
+For more information about this error, try `rustc --explain E0220`.
diff --git a/tests/ui/associated-inherent-types/really_deep_self_ty_mismatch.rs b/tests/ui/associated-inherent-types/really_deep_self_ty_mismatch.rs
new file mode 100644
index 00000000000..eac33f631bb
--- /dev/null
+++ b/tests/ui/associated-inherent-types/really_deep_self_ty_mismatch.rs
@@ -0,0 +1,26 @@
+//@ check-pass
+
+#![feature(inherent_associated_types)]
+#![expect(incomplete_features)]
+
+// Test that IAT resolution doesn't bail out when the self type is
+// very nested.
+
+struct Foo<T>(T);
+#[rustfmt::skip]
+impl Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<u8>>>>>>>>>>> {
+    type Inherent = u16;
+}
+#[rustfmt::skip]
+impl Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<u16>>>>>>>>>>> {
+    type Inherent = u32;
+}
+
+#[rustfmt::skip]
+struct Bar {
+    field: <Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<Foo<u8>>>>>>>>>>>>::Inherent,
+}
+
+fn main() {
+    Bar { field: 1_u16 };
+}
diff --git a/tests/ui/const-generics/mgca/unresolved-iac-1.rs b/tests/ui/const-generics/mgca/unresolved-iac-1.rs
new file mode 100644
index 00000000000..a0700aa5b65
--- /dev/null
+++ b/tests/ui/const-generics/mgca/unresolved-iac-1.rs
@@ -0,0 +1,11 @@
+#![feature(min_generic_const_args)]
+#![feature(inherent_associated_types)]
+#![expect(incomplete_features)]
+
+struct A(Box<[u8; Box::b]>);
+//~^ ERROR: associated constant `b` not found for
+
+impl A {
+  fn c(self) { self.0.d() }
+}
+fn main() {}
diff --git a/tests/ui/const-generics/mgca/unresolved-iac-1.stderr b/tests/ui/const-generics/mgca/unresolved-iac-1.stderr
new file mode 100644
index 00000000000..4bf1191e786
--- /dev/null
+++ b/tests/ui/const-generics/mgca/unresolved-iac-1.stderr
@@ -0,0 +1,16 @@
+error[E0220]: associated constant `b` not found for `Box<{type error}, {type error}>` in the current scope
+  --> $DIR/unresolved-iac-1.rs:5:24
+   |
+LL |   struct A(Box<[u8; Box::b]>);
+   |                          ^ associated item not found in `Box<{type error}, {type error}>`
+  --> $SRC_DIR/alloc/src/boxed.rs:LL:COL
+  ::: $SRC_DIR/alloc/src/boxed.rs:LL:COL
+   |
+   = note: associated constant `b` not found for this struct
+   |
+   = note: the associated constant was found for
+           
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0220`.
diff --git a/tests/ui/const-generics/mgca/unresolved-iac-2.rs b/tests/ui/const-generics/mgca/unresolved-iac-2.rs
new file mode 100644
index 00000000000..72bb5d7f627
--- /dev/null
+++ b/tests/ui/const-generics/mgca/unresolved-iac-2.rs
@@ -0,0 +1,14 @@
+#![feature(min_generic_const_args)]
+#![feature(inherent_associated_types)]
+#![expect(incomplete_features)]
+
+struct Foo<'a> {
+    x: &'a (),
+}
+
+impl<'a> Foo<'a> {
+    fn foo(_: [u8; Foo::X]) {}
+    //~^ ERROR: associated constant `X` not found for `Foo<'_>` in the current scope
+}
+
+fn main() {}
diff --git a/tests/ui/const-generics/mgca/unresolved-iac-2.stderr b/tests/ui/const-generics/mgca/unresolved-iac-2.stderr
new file mode 100644
index 00000000000..a6c12877a4e
--- /dev/null
+++ b/tests/ui/const-generics/mgca/unresolved-iac-2.stderr
@@ -0,0 +1,15 @@
+error[E0220]: associated constant `X` not found for `Foo<'_>` in the current scope
+  --> $DIR/unresolved-iac-2.rs:10:25
+   |
+LL | struct Foo<'a> {
+   | -------------- associated constant `X` not found for this struct
+...
+LL |     fn foo(_: [u8; Foo::X]) {}
+   |                         ^ associated item not found in `Foo<'_>`
+   |
+   = note: the associated constant was found for
+           
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0220`.