about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui/associated-consts/assoc-const-eq-ambiguity.rs19
-rw-r--r--tests/ui/associated-consts/assoc-const-eq-ambiguity.stderr38
-rw-r--r--tests/ui/associated-consts/assoc-const-eq-missing.rs13
-rw-r--r--tests/ui/associated-consts/assoc-const-eq-missing.stderr20
-rw-r--r--tests/ui/associated-consts/assoc-const-eq-ty-alias-noninteracting.rs21
-rw-r--r--tests/ui/associated-consts/assoc-const-ty-mismatch.rs20
-rw-r--r--tests/ui/associated-consts/assoc-const-ty-mismatch.stderr36
-rw-r--r--tests/ui/associated-consts/shadowed-const.rs2
-rw-r--r--tests/ui/associated-consts/shadowed-const.stderr12
-rw-r--r--tests/ui/associated-type-bounds/consts.rs2
-rw-r--r--tests/ui/associated-type-bounds/consts.stderr12
-rw-r--r--tests/ui/associated-type-bounds/issue-99828.rs2
-rw-r--r--tests/ui/associated-type-bounds/issue-99828.stderr10
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/missing.rs2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/missing.stderr5
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs2
-rw-r--r--tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr13
-rw-r--r--tests/ui/const-generics/assoc_const_eq_diagnostic.rs6
-rw-r--r--tests/ui/const-generics/assoc_const_eq_diagnostic.stderr28
-rw-r--r--tests/ui/error-codes/E0221.stderr2
-rw-r--r--tests/ui/feature-gates/feature-gate-return_type_notation.cfg.stderr13
-rw-r--r--tests/ui/feature-gates/feature-gate-return_type_notation.rs2
22 files changed, 199 insertions, 81 deletions
diff --git a/tests/ui/associated-consts/assoc-const-eq-ambiguity.rs b/tests/ui/associated-consts/assoc-const-eq-ambiguity.rs
new file mode 100644
index 00000000000..ac085864ff0
--- /dev/null
+++ b/tests/ui/associated-consts/assoc-const-eq-ambiguity.rs
@@ -0,0 +1,19 @@
+// We used to say "ambiguous associated type" on ambiguous associated consts.
+// Ensure that we now use the correct label.
+
+#![feature(associated_const_equality)]
+
+trait Trait0: Parent0<i32> + Parent0<u32> {}
+trait Parent0<T> { const K: (); }
+
+fn take0(_: impl Trait0<K = { () }>) {}
+//~^ ERROR ambiguous associated constant `K` in bounds of `Trait0`
+
+trait Trait1: Parent1 + Parent2 {}
+trait Parent1 { const C: i32; }
+trait Parent2 { const C: &'static str; }
+
+fn take1(_: impl Trait1<C = "?">) {}
+//~^ ERROR ambiguous associated constant `C` in bounds of `Trait1`
+
+fn main() {}
diff --git a/tests/ui/associated-consts/assoc-const-eq-ambiguity.stderr b/tests/ui/associated-consts/assoc-const-eq-ambiguity.stderr
new file mode 100644
index 00000000000..ba3a8701316
--- /dev/null
+++ b/tests/ui/associated-consts/assoc-const-eq-ambiguity.stderr
@@ -0,0 +1,38 @@
+error[E0222]: ambiguous associated constant `K` in bounds of `Trait0`
+  --> $DIR/assoc-const-eq-ambiguity.rs:9:25
+   |
+LL | trait Parent0<T> { const K: (); }
+   |                    -----------
+   |                    |
+   |                    ambiguous `K` from `Parent0<u32>`
+   |                    ambiguous `K` from `Parent0<i32>`
+LL |
+LL | fn take0(_: impl Trait0<K = { () }>) {}
+   |                         ^^^^^^^^^^ ambiguous associated constant `K`
+   |
+   = help: consider introducing a new type parameter `T` and adding `where` constraints:
+               where
+                   T: Trait0,
+                   T: Parent0<u32>::K = { () },
+                   T: Parent0<i32>::K = { () }
+
+error[E0222]: ambiguous associated constant `C` in bounds of `Trait1`
+  --> $DIR/assoc-const-eq-ambiguity.rs:16:25
+   |
+LL | trait Parent1 { const C: i32; }
+   |                 ------------ ambiguous `C` from `Parent1`
+LL | trait Parent2 { const C: &'static str; }
+   |                 --------------------- ambiguous `C` from `Parent2`
+LL |
+LL | fn take1(_: impl Trait1<C = "?">) {}
+   |                         ^^^^^^^ ambiguous associated constant `C`
+   |
+   = help: consider introducing a new type parameter `T` and adding `where` constraints:
+               where
+                   T: Trait1,
+                   T: Parent2::C = "?",
+                   T: Parent1::C = "?"
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0222`.
diff --git a/tests/ui/associated-consts/assoc-const-eq-missing.rs b/tests/ui/associated-consts/assoc-const-eq-missing.rs
index 5e029a12df2..f384927e4a3 100644
--- a/tests/ui/associated-consts/assoc-const-eq-missing.rs
+++ b/tests/ui/associated-consts/assoc-const-eq-missing.rs
@@ -11,13 +11,12 @@ impl Foo for Bar {
   const N: usize = 3;
 }
 
-
-fn foo1<F: Foo<Z=3>>() {}
-//~^ ERROR associated type
-fn foo2<F: Foo<Z=usize>>() {}
-//~^ ERROR associated type
-fn foo3<F: Foo<Z=5>>() {}
-//~^ ERROR associated type
+fn foo1<F: Foo<Z = 3>>() {}
+//~^ ERROR associated constant `Z` not found for `Foo`
+fn foo2<F: Foo<Z = usize>>() {}
+//~^ ERROR associated type `Z` not found for `Foo`
+fn foo3<F: Foo<Z = 5>>() {}
+//~^ ERROR associated constant `Z` not found for `Foo`
 
 fn main() {
   foo1::<Bar>();
diff --git a/tests/ui/associated-consts/assoc-const-eq-missing.stderr b/tests/ui/associated-consts/assoc-const-eq-missing.stderr
index b4bd6456c85..318c85dcfd6 100644
--- a/tests/ui/associated-consts/assoc-const-eq-missing.stderr
+++ b/tests/ui/associated-consts/assoc-const-eq-missing.stderr
@@ -1,20 +1,20 @@
-error[E0220]: associated type `Z` not found for `Foo`
-  --> $DIR/assoc-const-eq-missing.rs:15:16
+error[E0220]: associated constant `Z` not found for `Foo`
+  --> $DIR/assoc-const-eq-missing.rs:14:16
    |
-LL | fn foo1<F: Foo<Z=3>>() {}
-   |                ^ associated type `Z` not found
+LL | fn foo1<F: Foo<Z = 3>>() {}
+   |                ^ help: there is an associated constant with a similar name: `N`
 
 error[E0220]: associated type `Z` not found for `Foo`
-  --> $DIR/assoc-const-eq-missing.rs:17:16
+  --> $DIR/assoc-const-eq-missing.rs:16:16
    |
-LL | fn foo2<F: Foo<Z=usize>>() {}
+LL | fn foo2<F: Foo<Z = usize>>() {}
    |                ^ associated type `Z` not found
 
-error[E0220]: associated type `Z` not found for `Foo`
-  --> $DIR/assoc-const-eq-missing.rs:19:16
+error[E0220]: associated constant `Z` not found for `Foo`
+  --> $DIR/assoc-const-eq-missing.rs:18:16
    |
-LL | fn foo3<F: Foo<Z=5>>() {}
-   |                ^ associated type `Z` not found
+LL | fn foo3<F: Foo<Z = 5>>() {}
+   |                ^ help: there is an associated constant with a similar name: `N`
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/associated-consts/assoc-const-eq-ty-alias-noninteracting.rs b/tests/ui/associated-consts/assoc-const-eq-ty-alias-noninteracting.rs
new file mode 100644
index 00000000000..de9008bfcf9
--- /dev/null
+++ b/tests/ui/associated-consts/assoc-const-eq-ty-alias-noninteracting.rs
@@ -0,0 +1,21 @@
+// Regression test for issue #112560.
+// Respect the fact that (associated) types and constants live in different namespaces and
+// therefore equality bounds involving identically named associated items don't conflict if
+// their kind (type vs. const) differs.
+
+// FIXME(fmease): Extend this test to cover supertraits again
+// once #118040 is fixed. See initial version of PR #118360.
+
+// check-pass
+
+#![feature(associated_const_equality)]
+
+trait Trait {
+    type N;
+
+    const N: usize;
+}
+
+fn take(_: impl Trait<N = 0, N = ()>) {}
+
+fn main() {}
diff --git a/tests/ui/associated-consts/assoc-const-ty-mismatch.rs b/tests/ui/associated-consts/assoc-const-ty-mismatch.rs
index c5d78469e95..7211637659b 100644
--- a/tests/ui/associated-consts/assoc-const-ty-mismatch.rs
+++ b/tests/ui/associated-consts/assoc-const-ty-mismatch.rs
@@ -2,30 +2,30 @@
 #![allow(unused)]
 
 pub trait Foo {
-  const N: usize;
+    const N: usize;
 }
 
 pub trait FooTy {
-  type T;
+    type T;
 }
 
 pub struct Bar;
 
 impl Foo for Bar {
-  const N: usize = 3;
+    const N: usize = 3;
 }
 
 impl FooTy for Bar {
-  type T = usize;
+    type T = usize;
 }
 
 
-fn foo<F: Foo<N=usize>>() {}
-//~^ ERROR expected associated constant bound, found type
-fn foo2<F: FooTy<T=3usize>>() {}
-//~^ ERROR expected associated type bound, found constant
+fn foo<F: Foo<N = usize>>() {}
+//~^ ERROR expected constant, found type
+fn foo2<F: FooTy<T = 3usize>>() {}
+//~^ ERROR expected type, found constant
 
 fn main() {
-  foo::<Bar>();
-  foo2::<Bar>();
+    foo::<Bar>();
+    foo2::<Bar>();
 }
diff --git a/tests/ui/associated-consts/assoc-const-ty-mismatch.stderr b/tests/ui/associated-consts/assoc-const-ty-mismatch.stderr
index 11198729e38..b844cfc4ae4 100644
--- a/tests/ui/associated-consts/assoc-const-ty-mismatch.stderr
+++ b/tests/ui/associated-consts/assoc-const-ty-mismatch.stderr
@@ -1,26 +1,30 @@
-error: expected associated constant bound, found type
-  --> $DIR/assoc-const-ty-mismatch.rs:23:15
+error: expected constant, found type
+  --> $DIR/assoc-const-ty-mismatch.rs:23:19
    |
-LL | fn foo<F: Foo<N=usize>>() {}
-   |               ^^^^^^^
+LL | fn foo<F: Foo<N = usize>>() {}
+   |               -   ^^^^^ unexpected type
+   |               |
+   |               expected a constant because of this associated constant
    |
-note: associated constant defined here
-  --> $DIR/assoc-const-ty-mismatch.rs:5:3
+note: the associated constant is defined here
+  --> $DIR/assoc-const-ty-mismatch.rs:5:5
    |
-LL |   const N: usize;
-   |   ^^^^^^^^^^^^^^
+LL |     const N: usize;
+   |     ^^^^^^^^^^^^^^
 
-error: expected associated type bound, found constant
-  --> $DIR/assoc-const-ty-mismatch.rs:25:18
+error: expected type, found constant
+  --> $DIR/assoc-const-ty-mismatch.rs:25:22
    |
-LL | fn foo2<F: FooTy<T=3usize>>() {}
-   |                  ^^^^^^^^
+LL | fn foo2<F: FooTy<T = 3usize>>() {}
+   |                  -   ^^^^^^ unexpected constant
+   |                  |
+   |                  expected a type because of this associated type
    |
-note: associated type defined here
-  --> $DIR/assoc-const-ty-mismatch.rs:9:3
+note: the associated type is defined here
+  --> $DIR/assoc-const-ty-mismatch.rs:9:5
    |
-LL |   type T;
-   |   ^^^^^^
+LL |     type T;
+   |     ^^^^^^
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/associated-consts/shadowed-const.rs b/tests/ui/associated-consts/shadowed-const.rs
index cfdb391d39d..d9b565742d4 100644
--- a/tests/ui/associated-consts/shadowed-const.rs
+++ b/tests/ui/associated-consts/shadowed-const.rs
@@ -17,7 +17,7 @@ trait Baz2: Foo {
 trait Baz3 {
   const BAR: usize;
   const QUX: Self::BAR;
-  //~^ ERROR found associated const
+  //~^ ERROR expected type, found constant
 }
 
 fn main() {}
diff --git a/tests/ui/associated-consts/shadowed-const.stderr b/tests/ui/associated-consts/shadowed-const.stderr
index a01a9ae561f..2db645b3c96 100644
--- a/tests/ui/associated-consts/shadowed-const.stderr
+++ b/tests/ui/associated-consts/shadowed-const.stderr
@@ -1,8 +1,14 @@
-error: found associated const `BAR` when type was expected
-  --> $DIR/shadowed-const.rs:19:14
+error: expected type, found constant
+  --> $DIR/shadowed-const.rs:19:20
    |
 LL |   const QUX: Self::BAR;
-   |              ^^^^^^^^^
+   |                    ^^^ unexpected constant
+   |
+note: the associated constant is defined here
+  --> $DIR/shadowed-const.rs:18:3
+   |
+LL |   const BAR: usize;
+   |   ^^^^^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-type-bounds/consts.rs b/tests/ui/associated-type-bounds/consts.rs
index 9b95b1b52c0..8f90c36ed45 100644
--- a/tests/ui/associated-type-bounds/consts.rs
+++ b/tests/ui/associated-type-bounds/consts.rs
@@ -1,7 +1,7 @@
 #![feature(associated_type_bounds)]
 
 pub fn accept(_: impl Trait<K: Copy>) {}
-//~^ ERROR expected associated type, found associated constant
+//~^ ERROR expected type, found constant
 
 pub trait Trait {
     const K: i32;
diff --git a/tests/ui/associated-type-bounds/consts.stderr b/tests/ui/associated-type-bounds/consts.stderr
index eef24c8827b..7f9fe5e500a 100644
--- a/tests/ui/associated-type-bounds/consts.stderr
+++ b/tests/ui/associated-type-bounds/consts.stderr
@@ -1,10 +1,16 @@
-error: expected associated type, found associated constant
+error: expected type, found constant
   --> $DIR/consts.rs:3:29
    |
 LL | pub fn accept(_: impl Trait<K: Copy>) {}
-   |                             ^
+   |                             ^------ bounds are not allowed on associated constants
+   |                             |
+   |                             unexpected constant
    |
-   = note: trait bounds not allowed on associated constant
+note: the associated constant is defined here
+  --> $DIR/consts.rs:7:5
+   |
+LL |     const K: i32;
+   |     ^^^^^^^^^^^^
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-type-bounds/issue-99828.rs b/tests/ui/associated-type-bounds/issue-99828.rs
index 7b711283f5b..67ba50f3cbc 100644
--- a/tests/ui/associated-type-bounds/issue-99828.rs
+++ b/tests/ui/associated-type-bounds/issue-99828.rs
@@ -1,5 +1,5 @@
 fn get_iter(vec: &[i32]) -> impl Iterator<Item = {}> + '_ {
-    //~^ ERROR expected associated type bound, found constant
+    //~^ ERROR expected type, found constant
     //~| ERROR associated const equality is incomplete
     vec.iter()
 }
diff --git a/tests/ui/associated-type-bounds/issue-99828.stderr b/tests/ui/associated-type-bounds/issue-99828.stderr
index dc93c47dace..8813baf84de 100644
--- a/tests/ui/associated-type-bounds/issue-99828.stderr
+++ b/tests/ui/associated-type-bounds/issue-99828.stderr
@@ -7,13 +7,15 @@ LL | fn get_iter(vec: &[i32]) -> impl Iterator<Item = {}> + '_ {
    = note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
    = help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
 
-error: expected associated type bound, found constant
-  --> $DIR/issue-99828.rs:1:43
+error: expected type, found constant
+  --> $DIR/issue-99828.rs:1:50
    |
 LL | fn get_iter(vec: &[i32]) -> impl Iterator<Item = {}> + '_ {
-   |                                           ^^^^^^^^^
+   |                                           ----   ^^ unexpected constant
+   |                                           |
+   |                                           expected a type because of this associated type
    |
-note: associated type defined here
+note: the associated type is defined here
   --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/associated-type-bounds/return-type-notation/missing.rs b/tests/ui/associated-type-bounds/return-type-notation/missing.rs
index 0679b96f6c5..e6270ec3166 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/missing.rs
+++ b/tests/ui/associated-type-bounds/return-type-notation/missing.rs
@@ -8,6 +8,6 @@ trait Trait {
 }
 
 fn bar<T: Trait<methid(): Send>>() {}
-//~^ ERROR cannot find associated function `methid` for `Trait`
+//~^ ERROR associated function `methid` not found for `Trait`
 
 fn main() {}
diff --git a/tests/ui/associated-type-bounds/return-type-notation/missing.stderr b/tests/ui/associated-type-bounds/return-type-notation/missing.stderr
index 3ca5e66866d..db9cb9f49a3 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/missing.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/missing.stderr
@@ -7,11 +7,12 @@ LL | #![feature(return_type_notation)]
    = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
    = note: `#[warn(incomplete_features)]` on by default
 
-error: cannot find associated function `methid` for `Trait`
+error[E0220]: associated function `methid` not found for `Trait`
   --> $DIR/missing.rs:10:17
    |
 LL | fn bar<T: Trait<methid(): Send>>() {}
-   |                 ^^^^^^^^^^^^^^
+   |                 ^^^^^^ help: there is an associated function with a similar name: `method`
 
 error: aborting due to 1 previous error; 1 warning emitted
 
+For more information about this error, try `rustc --explain E0220`.
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs
index 891b30638ee..73c08531599 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs
+++ b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.rs
@@ -23,7 +23,7 @@ impl Foo for () {}
 fn test<T>()
 where
     T: Foo<test(): Send>,
-    //~^ ERROR ambiguous associated function `test` for `Foo`
+    //~^ ERROR ambiguous associated function `test` in bounds of `Foo`
 {
 }
 
diff --git a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr
index 7eaf3b82d98..4003aad6d03 100644
--- a/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr
+++ b/tests/ui/async-await/return-type-notation/super-method-bound-ambig.stderr
@@ -7,13 +7,18 @@ LL | #![feature(return_type_notation)]
    = note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information
    = note: `#[warn(incomplete_features)]` on by default
 
-error: ambiguous associated function `test` for `Foo`
+error[E0221]: ambiguous associated function `test` in bounds of `Foo`
   --> $DIR/super-method-bound-ambig.rs:25:12
    |
+LL |     async fn test();
+   |     ---------------- ambiguous `test` from `for<'a> Super1<'a>`
+...
+LL |     async fn test();
+   |     ---------------- ambiguous `test` from `Super2`
+...
 LL |     T: Foo<test(): Send>,
-   |            ^^^^^^^^^^^^
-   |
-   = note: `test` is declared in two supertraits: `Super2` and `Super1<'a>`
+   |            ^^^^^^^^^^^^ ambiguous associated function `test`
 
 error: aborting due to 1 previous error; 1 warning emitted
 
+For more information about this error, try `rustc --explain E0221`.
diff --git a/tests/ui/const-generics/assoc_const_eq_diagnostic.rs b/tests/ui/const-generics/assoc_const_eq_diagnostic.rs
index bf8202ac152..d51696f9ebd 100644
--- a/tests/ui/const-generics/assoc_const_eq_diagnostic.rs
+++ b/tests/ui/const-generics/assoc_const_eq_diagnostic.rs
@@ -9,9 +9,9 @@ pub trait Parse {
 }
 
 pub trait CoolStuff: Parse<MODE = Mode::Cool> {}
-//~^ ERROR expected associated constant bound
-//~| ERROR expected associated constant bound
-//~| ERROR expected type
+//~^ ERROR expected type, found variant
+//~| ERROR expected constant, found type
+//~| ERROR expected constant, found type
 
 fn no_help() -> Mode::Cool {}
 //~^ ERROR expected type, found variant
diff --git a/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr b/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr
index 6d5cd45479e..3d724bb1642 100644
--- a/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr
+++ b/tests/ui/const-generics/assoc_const_eq_diagnostic.stderr
@@ -16,30 +16,42 @@ LL | fn no_help() -> Mode::Cool {}
    |                 not a type
    |                 help: try using the variant's enum: `Mode`
 
-error: expected associated constant bound, found type
-  --> $DIR/assoc_const_eq_diagnostic.rs:11:28
+error: expected constant, found type
+  --> $DIR/assoc_const_eq_diagnostic.rs:11:35
    |
 LL | pub trait CoolStuff: Parse<MODE = Mode::Cool> {}
-   |                            ^^^^^^^^^^^^^^^^^ help: if equating a const, try wrapping with braces: `MODE = { const }`
+   |                            ----   ^^^^^^^^^^ unexpected type
+   |                            |
+   |                            expected a constant because of this associated constant
    |
-note: associated constant defined here
+note: the associated constant is defined here
   --> $DIR/assoc_const_eq_diagnostic.rs:8:5
    |
 LL |     const MODE: Mode;
    |     ^^^^^^^^^^^^^^^^
+help: consider adding braces here
+   |
+LL | pub trait CoolStuff: Parse<MODE = { Mode::Cool }> {}
+   |                                   +            +
 
-error: expected associated constant bound, found type
-  --> $DIR/assoc_const_eq_diagnostic.rs:11:28
+error: expected constant, found type
+  --> $DIR/assoc_const_eq_diagnostic.rs:11:35
    |
 LL | pub trait CoolStuff: Parse<MODE = Mode::Cool> {}
-   |                            ^^^^^^^^^^^^^^^^^ help: if equating a const, try wrapping with braces: `MODE = { const }`
+   |                            ----   ^^^^^^^^^^ unexpected type
+   |                            |
+   |                            expected a constant because of this associated constant
    |
-note: associated constant defined here
+note: the associated constant is defined here
   --> $DIR/assoc_const_eq_diagnostic.rs:8:5
    |
 LL |     const MODE: Mode;
    |     ^^^^^^^^^^^^^^^^
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: consider adding braces here
+   |
+LL | pub trait CoolStuff: Parse<MODE = { Mode::Cool }> {}
+   |                                   +            +
 
 error: aborting due to 4 previous errors
 
diff --git a/tests/ui/error-codes/E0221.stderr b/tests/ui/error-codes/E0221.stderr
index e600acf7834..07e7485b67e 100644
--- a/tests/ui/error-codes/E0221.stderr
+++ b/tests/ui/error-codes/E0221.stderr
@@ -28,7 +28,7 @@ LL |     fn test() {
 LL |         let _: Self::Err;
    |                ^^^^^^^^^ ambiguous associated type `Err`
    |
-   = note: associated type `Self` could derive from `FromStr`
+   = note: associated type `Err` could derive from `FromStr`
 help: use fully-qualified syntax to disambiguate
    |
 LL |         let _: <Self as My>::Err;
diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.cfg.stderr b/tests/ui/feature-gates/feature-gate-return_type_notation.cfg.stderr
index 1bdb2574ead..a15b01618f5 100644
--- a/tests/ui/feature-gates/feature-gate-return_type_notation.cfg.stderr
+++ b/tests/ui/feature-gates/feature-gate-return_type_notation.cfg.stderr
@@ -15,13 +15,18 @@ LL | fn foo<T: Trait<m(): Send>>() {}
    |                  |
    |                  help: remove these parentheses
 
-error[E0220]: associated type `m` not found for `Trait`
+error: expected type, found function
   --> $DIR/feature-gate-return_type_notation.rs:14:17
    |
 LL | fn foo<T: Trait<m(): Send>>() {}
-   |                 ^ associated type `m` not found
+   |                 ^ unexpected function
+   |
+note: the associated function is defined here
+  --> $DIR/feature-gate-return_type_notation.rs:10:5
+   |
+LL |     async fn m();
+   |     ^^^^^^^^^^^^^
 
 error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0220, E0658.
-For more information about an error, try `rustc --explain E0220`.
+For more information about this error, try `rustc --explain E0658`.
diff --git a/tests/ui/feature-gates/feature-gate-return_type_notation.rs b/tests/ui/feature-gates/feature-gate-return_type_notation.rs
index 86e2c48e188..60ac9f8d4f1 100644
--- a/tests/ui/feature-gates/feature-gate-return_type_notation.rs
+++ b/tests/ui/feature-gates/feature-gate-return_type_notation.rs
@@ -14,7 +14,7 @@ trait Trait {
 fn foo<T: Trait<m(): Send>>() {}
 //[cfg]~^ ERROR return type notation is experimental
 //[cfg]~| ERROR parenthesized generic arguments cannot be used in associated type constraints
-//[cfg]~| ERROR associated type `m` not found for `Trait`
+//[cfg]~| ERROR expected type, found function
 //[no]~^^^^ WARN return type notation is experimental
 //[no]~| WARN unstable syntax can change at any point in the future, causing a hard error!