about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-05-22 21:02:18 +0000
committerbors <bors@rust-lang.org>2025-05-22 21:02:18 +0000
commit912981a9eab199a6429d3c65a58f1b80487620ea (patch)
tree7c67aa94e1254e6617a7d0cae8f1eaf9cd8f2911 /tests/ui
parent2eef47813f25df637026ce3288880e5c587abd92 (diff)
parent8c2508292bcf2b20f675d25ec5d820ae19202aa4 (diff)
downloadrust-912981a9eab199a6429d3c65a58f1b80487620ea.tar.gz
rust-912981a9eab199a6429d3c65a58f1b80487620ea.zip
Auto merge of #141396 - matthiaskrgr:rollup-feg050g, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #135562 (Add ignore value suggestion in closure body)
 - #139635 (Finalize repeat expr inference behaviour with inferred repeat counts)
 - #139668 (Handle regions equivalent to 'static in non_local_bounds)
 - #140218 (HIR ty lowering: Clean up & refactor the lowering of type-relative paths)
 - #140435 (use uX::from instead of _ as uX in non - const contexts)
 - #141130 (rustc_on_unimplemented cleanups)
 - #141286 (Querify `coroutine_hidden_types`)

Failed merges:

 - #140247 (Don't build `ParamEnv` and do trait solving in `ItemCtxt`s when lowering IATs)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/associated-inherent-types/not-found-self-type-differs-shadowing-trait-item.uncovered.stderr8
-rw-r--r--tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr7
-rw-r--r--tests/ui/associated-item/associated-item-duplicate-names-3.stderr8
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr2
-rw-r--r--tests/ui/associated-type-bounds/return-type-notation/path-non-param-qself.stderr17
-rw-r--r--tests/ui/associated-types/associated-types-in-ambiguous-context.stderr16
-rw-r--r--tests/ui/borrowck/unconstrained-closure-lifetime-generic.rs22
-rw-r--r--tests/ui/borrowck/unconstrained-closure-lifetime-generic.stderr119
-rw-r--r--tests/ui/borrowck/unconstrained-closure-lifetime-trait-object.rs11
-rw-r--r--tests/ui/borrowck/unconstrained-closure-lifetime-trait-object.stderr17
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.rs6
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr63
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs6
-rw-r--r--tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr48
-rw-r--r--tests/ui/error-codes/E0223.stderr8
-rw-r--r--tests/ui/lang-items/lang-item-generic-requirements.rs2
-rw-r--r--tests/ui/lang-items/lang-item-generic-requirements.stderr20
-rw-r--r--tests/ui/lint/bare-trait-objects-path.stderr8
-rw-r--r--tests/ui/on-unimplemented/bad-annotation.rs12
-rw-r--r--tests/ui/on-unimplemented/bad-annotation.stderr14
-rw-r--r--tests/ui/on-unimplemented/on-trait.rs2
-rw-r--r--tests/ui/qualified/qualified-path-params-2.stderr2
-rw-r--r--tests/ui/repeat-expr/copy-check-const-element-uninferred-count.rs72
-rw-r--r--tests/ui/repeat-expr/copy-check-const-element-uninferred-count.stderr15
-rw-r--r--tests/ui/repeat-expr/copy-check-deferred-after-fallback.rs64
-rw-r--r--tests/ui/repeat-expr/copy-check-deferred-after-fallback.stderr12
-rw-r--r--tests/ui/repeat-expr/copy-check-deferred-before-fallback.rs65
-rw-r--r--tests/ui/repeat-expr/copy-check-inference-side-effects.rs34
-rw-r--r--tests/ui/repeat-expr/copy-check-inference-side-effects.stderr28
-rw-r--r--tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.rs9
-rw-r--r--tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.stderr17
-rw-r--r--tests/ui/self/self-impl.stderr16
-rw-r--r--tests/ui/structs/struct-path-associated-type.stderr24
-rw-r--r--tests/ui/traits/item-privacy.stderr16
-rw-r--r--tests/ui/transmute/unnecessary-transmutation.fixed24
-rw-r--r--tests/ui/transmute/unnecessary-transmutation.rs20
-rw-r--r--tests/ui/transmute/unnecessary-transmutation.stderr113
-rw-r--r--tests/ui/typeck/closure-ty-mismatch-issue-128561.rs10
-rw-r--r--tests/ui/typeck/closure-ty-mismatch-issue-128561.stderr28
-rw-r--r--tests/ui/typeck/ice-unexpected-region-123863.stderr2
-rw-r--r--tests/ui/typeck/issue-107087.stderr8
41 files changed, 807 insertions, 188 deletions
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 978305c2ce3..3e914e0538d 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
@@ -2,7 +2,13 @@ error[E0223]: ambiguous associated type
   --> $DIR/not-found-self-type-differs-shadowing-trait-item.rs:28:12
    |
 LL |     let _: S::<bool>::Pr = ();
-   |            ^^^^^^^^^^^^^ help: use fully-qualified syntax: `<S<bool> as Tr>::Pr`
+   |            ^^^^^^^^^^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL -     let _: S::<bool>::Pr = ();
+LL +     let _: <S<bool> as Tr>::Pr = ();
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr b/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr
index 9e1dd739807..fcf6b4c3e73 100644
--- a/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr
+++ b/tests/ui/associated-item/ambiguous-associated-type-with-generics.stderr
@@ -2,7 +2,12 @@ error[E0223]: ambiguous associated type
   --> $DIR/ambiguous-associated-type-with-generics.rs:13:13
    |
 LL |     let _x: <dyn Trait<i32>>::Ty;
-   |             ^^^^^^^^^^^^^^^^^^^^ help: use fully-qualified syntax: `<dyn Trait<i32> as Assoc>::Ty`
+   |             ^^^^^^^^^^^^^^^^^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL |     let _x: <dyn Trait<i32> as Assoc>::Ty;
+   |                             ++++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/associated-item/associated-item-duplicate-names-3.stderr b/tests/ui/associated-item/associated-item-duplicate-names-3.stderr
index a2346e292ac..84a9da09988 100644
--- a/tests/ui/associated-item/associated-item-duplicate-names-3.stderr
+++ b/tests/ui/associated-item/associated-item-duplicate-names-3.stderr
@@ -13,7 +13,13 @@ error[E0223]: ambiguous associated type
   --> $DIR/associated-item-duplicate-names-3.rs:18:12
    |
 LL |     let x: Baz::Bar = 5;
-   |            ^^^^^^^^ help: use fully-qualified syntax: `<Baz as Foo>::Bar`
+   |            ^^^^^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL -     let x: Baz::Bar = 5;
+LL +     let x: <Baz as Foo>::Bar = 5;
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr
index aad6dfc496b..a13fdbda1bf 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/path-no-qself.stderr
@@ -7,7 +7,7 @@ LL |     Trait::method(..): Send,
 help: if there were a type named `Example` that implemented `Trait`, you could use the fully-qualified path
    |
 LL -     Trait::method(..): Send,
-LL +     <Example as Trait>::method: Send,
+LL +     <Example as Trait>::method(..): Send,
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/associated-type-bounds/return-type-notation/path-non-param-qself.stderr b/tests/ui/associated-type-bounds/return-type-notation/path-non-param-qself.stderr
index 38202bdbf07..4c4c2c24079 100644
--- a/tests/ui/associated-type-bounds/return-type-notation/path-non-param-qself.stderr
+++ b/tests/ui/associated-type-bounds/return-type-notation/path-non-param-qself.stderr
@@ -3,18 +3,35 @@ error[E0223]: ambiguous associated function
    |
 LL |     <()>::method(..): Send,
    |     ^^^^^^^^^^^^^^^^
+   |
+help: if there were a trait named `Example` with associated function `method` implemented for `()`, you could use the fully-qualified path
+   |
+LL |     <() as Example>::method(..): Send,
+   |         ++++++++++
 
 error[E0223]: ambiguous associated function
   --> $DIR/path-non-param-qself.rs:13:5
    |
 LL |     i32::method(..): Send,
    |     ^^^^^^^^^^^^^^^
+   |
+help: if there were a trait named `Example` with associated function `method` implemented for `i32`, you could use the fully-qualified path
+   |
+LL -     i32::method(..): Send,
+LL +     <i32 as Example>::method(..): Send,
+   |
 
 error[E0223]: ambiguous associated function
   --> $DIR/path-non-param-qself.rs:15:5
    |
 LL |     Adt::method(..): Send,
    |     ^^^^^^^^^^^^^^^
+   |
+help: if there were a trait named `Example` with associated function `method` implemented for `Adt`, you could use the fully-qualified path
+   |
+LL -     Adt::method(..): Send,
+LL +     <Adt as Example>::method(..): Send,
+   |
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
index 1be8db5ddf4..a7647cf26aa 100644
--- a/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
+++ b/tests/ui/associated-types/associated-types-in-ambiguous-context.stderr
@@ -14,7 +14,13 @@ error[E0223]: ambiguous associated type
   --> $DIR/associated-types-in-ambiguous-context.rs:22:17
    |
 LL | trait Foo where Foo::Assoc: Bar {
-   |                 ^^^^^^^^^^ help: use fully-qualified syntax: `<Self as Foo>::Assoc`
+   |                 ^^^^^^^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL - trait Foo where Foo::Assoc: Bar {
+LL + trait Foo where <Self as Foo>::Assoc: Bar {
+   |
 
 error[E0223]: ambiguous associated type
   --> $DIR/associated-types-in-ambiguous-context.rs:27:10
@@ -42,7 +48,13 @@ error[E0223]: ambiguous associated type
   --> $DIR/associated-types-in-ambiguous-context.rs:13:23
    |
 LL |     fn grab(&self) -> Grab::Value;
-   |                       ^^^^^^^^^^^ help: use fully-qualified syntax: `<Self as Grab>::Value`
+   |                       ^^^^^^^^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL -     fn grab(&self) -> Grab::Value;
+LL +     fn grab(&self) -> <Self as Grab>::Value;
+   |
 
 error[E0223]: ambiguous associated type
   --> $DIR/associated-types-in-ambiguous-context.rs:16:22
diff --git a/tests/ui/borrowck/unconstrained-closure-lifetime-generic.rs b/tests/ui/borrowck/unconstrained-closure-lifetime-generic.rs
new file mode 100644
index 00000000000..4fdf5470fea
--- /dev/null
+++ b/tests/ui/borrowck/unconstrained-closure-lifetime-generic.rs
@@ -0,0 +1,22 @@
+// Regression test for #122704
+use std::any::Any;
+
+pub struct Foo {
+    bar: Box<dyn for<'a> Fn(&'a usize) -> Box<dyn Any + 'a>>,
+}
+
+impl Foo {
+    pub fn ack<I>(&mut self, f: impl for<'a> Fn(&'a usize) -> Box<I>) {
+        self.bar = Box::new(|baz| Box::new(f(baz)));
+        //~^ ERROR the parameter type `impl for<'a> Fn(&'a usize) -> Box<I>` may not live long enough
+        //~| ERROR the parameter type `impl for<'a> Fn(&'a usize) -> Box<I>` may not live long enough
+        //~| ERROR the parameter type `impl for<'a> Fn(&'a usize) -> Box<I>` may not live long enough
+        //~| ERROR the parameter type `impl for<'a> Fn(&'a usize) -> Box<I>` may not live long enough
+        //~| ERROR the parameter type `I` may not live long enough
+        //~| ERROR the parameter type `I` may not live long enough
+        //~| ERROR the parameter type `I` may not live long enough
+        //~| ERROR `f` does not live long enough
+    }
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/unconstrained-closure-lifetime-generic.stderr b/tests/ui/borrowck/unconstrained-closure-lifetime-generic.stderr
new file mode 100644
index 00000000000..df86ce79f09
--- /dev/null
+++ b/tests/ui/borrowck/unconstrained-closure-lifetime-generic.stderr
@@ -0,0 +1,119 @@
+error[E0310]: the parameter type `impl for<'a> Fn(&'a usize) -> Box<I>` may not live long enough
+  --> $DIR/unconstrained-closure-lifetime-generic.rs:10:9
+   |
+LL |         self.bar = Box::new(|baz| Box::new(f(baz)));
+   |         ^^^^^^^^
+   |         |
+   |         the parameter type `impl for<'a> Fn(&'a usize) -> Box<I>` must be valid for the static lifetime...
+   |         ...so that the type `impl for<'a> Fn(&'a usize) -> Box<I>` will meet its required lifetime bounds
+   |
+help: consider adding an explicit lifetime bound
+   |
+LL |     pub fn ack<I>(&mut self, f: impl for<'a> Fn(&'a usize) -> Box<I> + 'static) {
+   |                                                                      +++++++++
+
+error[E0310]: the parameter type `impl for<'a> Fn(&'a usize) -> Box<I>` may not live long enough
+  --> $DIR/unconstrained-closure-lifetime-generic.rs:10:9
+   |
+LL |         self.bar = Box::new(|baz| Box::new(f(baz)));
+   |         ^^^^^^^^
+   |         |
+   |         the parameter type `impl for<'a> Fn(&'a usize) -> Box<I>` must be valid for the static lifetime...
+   |         ...so that the type `impl for<'a> Fn(&'a usize) -> Box<I>` will meet its required lifetime bounds
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: consider adding an explicit lifetime bound
+   |
+LL |     pub fn ack<I>(&mut self, f: impl for<'a> Fn(&'a usize) -> Box<I> + 'static) {
+   |                                                                      +++++++++
+
+error[E0310]: the parameter type `impl for<'a> Fn(&'a usize) -> Box<I>` may not live long enough
+  --> $DIR/unconstrained-closure-lifetime-generic.rs:10:20
+   |
+LL |         self.bar = Box::new(|baz| Box::new(f(baz)));
+   |                    ^^^^^^^^
+   |                    |
+   |                    the parameter type `impl for<'a> Fn(&'a usize) -> Box<I>` must be valid for the static lifetime...
+   |                    ...so that the type `impl for<'a> Fn(&'a usize) -> Box<I>` will meet its required lifetime bounds
+   |
+help: consider adding an explicit lifetime bound
+   |
+LL |     pub fn ack<I>(&mut self, f: impl for<'a> Fn(&'a usize) -> Box<I> + 'static) {
+   |                                                                      +++++++++
+
+error[E0310]: the parameter type `impl for<'a> Fn(&'a usize) -> Box<I>` may not live long enough
+  --> $DIR/unconstrained-closure-lifetime-generic.rs:10:20
+   |
+LL |         self.bar = Box::new(|baz| Box::new(f(baz)));
+   |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |                    |
+   |                    the parameter type `impl for<'a> Fn(&'a usize) -> Box<I>` must be valid for the static lifetime...
+   |                    ...so that the type `impl for<'a> Fn(&'a usize) -> Box<I>` will meet its required lifetime bounds
+   |
+help: consider adding an explicit lifetime bound
+   |
+LL |     pub fn ack<I>(&mut self, f: impl for<'a> Fn(&'a usize) -> Box<I> + 'static) {
+   |                                                                      +++++++++
+
+error[E0310]: the parameter type `I` may not live long enough
+  --> $DIR/unconstrained-closure-lifetime-generic.rs:10:35
+   |
+LL |         self.bar = Box::new(|baz| Box::new(f(baz)));
+   |                                   ^^^^^^^^^^^^^^^^
+   |                                   |
+   |                                   the parameter type `I` must be valid for the static lifetime...
+   |                                   ...so that the type `I` will meet its required lifetime bounds
+   |
+help: consider adding an explicit lifetime bound
+   |
+LL |     pub fn ack<I: 'static>(&mut self, f: impl for<'a> Fn(&'a usize) -> Box<I>) {
+   |                 +++++++++
+
+error[E0310]: the parameter type `I` may not live long enough
+  --> $DIR/unconstrained-closure-lifetime-generic.rs:10:35
+   |
+LL |         self.bar = Box::new(|baz| Box::new(f(baz)));
+   |                                   ^^^^^^^^^^^^^^^^
+   |                                   |
+   |                                   the parameter type `I` must be valid for the static lifetime...
+   |                                   ...so that the type `I` will meet its required lifetime bounds
+   |
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+help: consider adding an explicit lifetime bound
+   |
+LL |     pub fn ack<I: 'static>(&mut self, f: impl for<'a> Fn(&'a usize) -> Box<I>) {
+   |                 +++++++++
+
+error[E0311]: the parameter type `I` may not live long enough
+  --> $DIR/unconstrained-closure-lifetime-generic.rs:10:35
+   |
+LL |     pub fn ack<I>(&mut self, f: impl for<'a> Fn(&'a usize) -> Box<I>) {
+   |                   --------- the parameter type `I` must be valid for the anonymous lifetime defined here...
+LL |         self.bar = Box::new(|baz| Box::new(f(baz)));
+   |                                   ^^^^^^^^^^^^^^^^ ...so that the type `I` will meet its required lifetime bounds
+   |
+help: consider adding an explicit lifetime bound
+   |
+LL |     pub fn ack<'a, I: 'a>(&'a mut self, f: impl for<'a> Fn(&'a usize) -> Box<I>) {
+   |                +++  ++++   ++
+
+error[E0597]: `f` does not live long enough
+  --> $DIR/unconstrained-closure-lifetime-generic.rs:10:44
+   |
+LL |     pub fn ack<I>(&mut self, f: impl for<'a> Fn(&'a usize) -> Box<I>) {
+   |                              - binding `f` declared here
+LL |         self.bar = Box::new(|baz| Box::new(f(baz)));
+   |         --------            -----          ^ borrowed value does not live long enough
+   |         |                   |
+   |         |                   value captured here
+   |         coercion requires that `f` is borrowed for `'static`
+...
+LL |     }
+   |     - `f` dropped here while still borrowed
+   |
+   = note: due to object lifetime defaults, `Box<dyn for<'a> Fn(&'a usize) -> Box<(dyn Any + 'a)>>` actually means `Box<(dyn for<'a> Fn(&'a usize) -> Box<(dyn Any + 'a)> + 'static)>`
+
+error: aborting due to 8 previous errors
+
+Some errors have detailed explanations: E0310, E0311, E0597.
+For more information about an error, try `rustc --explain E0310`.
diff --git a/tests/ui/borrowck/unconstrained-closure-lifetime-trait-object.rs b/tests/ui/borrowck/unconstrained-closure-lifetime-trait-object.rs
new file mode 100644
index 00000000000..3eee98d9bdb
--- /dev/null
+++ b/tests/ui/borrowck/unconstrained-closure-lifetime-trait-object.rs
@@ -0,0 +1,11 @@
+// Regression test for #139004
+use std::any::Any;
+
+type B = Box<dyn for<'a> Fn(&(dyn Any + 'a)) -> Box<dyn Any + 'a>>;
+
+fn foo<E>() -> B {
+    Box::new(|e| Box::new(e.is::<E>()))
+    //~^ ERROR the parameter type `E` may not live long enough
+}
+
+fn main() {}
diff --git a/tests/ui/borrowck/unconstrained-closure-lifetime-trait-object.stderr b/tests/ui/borrowck/unconstrained-closure-lifetime-trait-object.stderr
new file mode 100644
index 00000000000..c9d5f78828d
--- /dev/null
+++ b/tests/ui/borrowck/unconstrained-closure-lifetime-trait-object.stderr
@@ -0,0 +1,17 @@
+error[E0310]: the parameter type `E` may not live long enough
+  --> $DIR/unconstrained-closure-lifetime-trait-object.rs:7:29
+   |
+LL |     Box::new(|e| Box::new(e.is::<E>()))
+   |                             ^^
+   |                             |
+   |                             the parameter type `E` must be valid for the static lifetime...
+   |                             ...so that the type `E` will meet its required lifetime bounds
+   |
+help: consider adding an explicit lifetime bound
+   |
+LL | fn foo<E: 'static>() -> B {
+   |         +++++++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0310`.
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.rs b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.rs
index b76b550fcb2..a0e497fa045 100644
--- a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.rs
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.rs
@@ -3,7 +3,7 @@
 //@ reference: attributes.diagnostic.on_unimplemented.syntax
 //@ reference: attributes.diagnostic.on_unimplemented.invalid-formats
 #[diagnostic::on_unimplemented(
-    on(_Self = "&str"),
+    on(Self = "&str"),
     //~^WARN malformed `on_unimplemented` attribute
     //~|WARN malformed `on_unimplemented` attribute
     message = "trait has `{Self}` and `{T}` as params",
@@ -41,7 +41,7 @@ impl Bar for i32 {}
     //~|WARN there is no parameter `integral` on trait `Baz`
     //~|WARN there is no parameter `integer` on trait `Baz`
     //~|WARN there is no parameter `integer` on trait `Baz`
-    label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+    label = "{float}{_Self}{crate_local}{Trait}{ItemContext}{This}"
     //~^WARN there is no parameter `float` on trait `Baz`
     //~|WARN there is no parameter `float` on trait `Baz`
     //~|WARN there is no parameter `_Self` on trait `Baz`
@@ -52,6 +52,8 @@ impl Bar for i32 {}
     //~|WARN there is no parameter `Trait` on trait `Baz`
     //~|WARN there is no parameter `ItemContext` on trait `Baz`
     //~|WARN there is no parameter `ItemContext` on trait `Baz`
+    //~|WARN there is no parameter `This` on trait `Baz`
+    //~|WARN there is no parameter `This` on trait `Baz`
 )]
 trait Baz {}
 
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr
index 88816a98dcf..8dace7d9052 100644
--- a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_accept_options_of_the_internal_rustc_attribute.stderr
@@ -9,8 +9,8 @@ LL | #[diagnostic::on_unimplemented(message = "Not allowed to apply it on a impl
 warning: malformed `on_unimplemented` attribute
   --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:6:5
    |
-LL |     on(_Self = "&str"),
-   |     ^^^^^^^^^^^^^^^^^^ invalid option found here
+LL |     on(Self = "&str"),
+   |     ^^^^^^^^^^^^^^^^^ invalid option found here
    |
    = help: only `message`, `note` and `label` are allowed as options
 
@@ -81,7 +81,7 @@ LL |     message = "{from_desugaring}{direct}{cause}{integral}{integer}",
 warning: there is no parameter `float` on trait `Baz`
   --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:44:15
    |
-LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}{This}"
    |               ^^^^^
    |
    = help: expect either a generic argument name or `{Self}` as format argument
@@ -89,7 +89,7 @@ LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
 warning: there is no parameter `_Self` on trait `Baz`
   --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:44:22
    |
-LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}{This}"
    |                      ^^^^^
    |
    = help: expect either a generic argument name or `{Self}` as format argument
@@ -97,7 +97,7 @@ LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
 warning: there is no parameter `crate_local` on trait `Baz`
   --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:44:29
    |
-LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}{This}"
    |                             ^^^^^^^^^^^
    |
    = help: expect either a generic argument name or `{Self}` as format argument
@@ -105,7 +105,7 @@ LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
 warning: there is no parameter `Trait` on trait `Baz`
   --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:44:42
    |
-LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}{This}"
    |                                          ^^^^^
    |
    = help: expect either a generic argument name or `{Self}` as format argument
@@ -113,16 +113,24 @@ LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
 warning: there is no parameter `ItemContext` on trait `Baz`
   --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:44:49
    |
-LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}{This}"
    |                                                 ^^^^^^^^^^^
    |
    = help: expect either a generic argument name or `{Self}` as format argument
 
+warning: there is no parameter `This` on trait `Baz`
+  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:44:62
+   |
+LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}{This}"
+   |                                                              ^^^^
+   |
+   = help: expect either a generic argument name or `{Self}` as format argument
+
 warning: malformed `on_unimplemented` attribute
   --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:6:5
    |
-LL |     on(_Self = "&str"),
-   |     ^^^^^^^^^^^^^^^^^^ invalid option found here
+LL |     on(Self = "&str"),
+   |     ^^^^^^^^^^^^^^^^^ invalid option found here
    |
    = help: only `message`, `note` and `label` are allowed as options
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
@@ -146,7 +154,7 @@ LL |     append_const_msg
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: trait has `()` and `i32` as params
-  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:63:15
+  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:65:15
    |
 LL |     takes_foo(());
    |     --------- ^^ trait has `()` and `i32` as params
@@ -161,7 +169,7 @@ help: this trait has no implementations, consider adding one
 LL | trait Foo<T> {}
    | ^^^^^^^^^^^^
 note: required by a bound in `takes_foo`
-  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:58:22
+  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:60:22
    |
 LL | fn takes_foo(_: impl Foo<i32>) {}
    |                      ^^^^^^^^ required by this bound in `takes_foo`
@@ -176,7 +184,7 @@ LL | #[diagnostic::on_unimplemented = "Message"]
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: the trait bound `(): Bar` is not satisfied
-  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:65:15
+  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:67:15
    |
 LL |     takes_bar(());
    |     --------- ^^ the trait `Bar` is not implemented for `()`
@@ -185,7 +193,7 @@ LL |     takes_bar(());
    |
    = help: the trait `Bar` is implemented for `i32`
 note: required by a bound in `takes_bar`
-  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:59:22
+  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:61:22
    |
 LL | fn takes_bar(_: impl Bar) {}
    |                      ^^^ required by this bound in `takes_bar`
@@ -238,7 +246,7 @@ LL |     message = "{from_desugaring}{direct}{cause}{integral}{integer}",
 warning: there is no parameter `float` on trait `Baz`
   --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:44:15
    |
-LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}{This}"
    |               ^^^^^
    |
    = help: expect either a generic argument name or `{Self}` as format argument
@@ -247,7 +255,7 @@ LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
 warning: there is no parameter `_Self` on trait `Baz`
   --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:44:22
    |
-LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}{This}"
    |                      ^^^^^
    |
    = help: expect either a generic argument name or `{Self}` as format argument
@@ -256,7 +264,7 @@ LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
 warning: there is no parameter `crate_local` on trait `Baz`
   --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:44:29
    |
-LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}{This}"
    |                             ^^^^^^^^^^^
    |
    = help: expect either a generic argument name or `{Self}` as format argument
@@ -265,7 +273,7 @@ LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
 warning: there is no parameter `Trait` on trait `Baz`
   --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:44:42
    |
-LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}{This}"
    |                                          ^^^^^
    |
    = help: expect either a generic argument name or `{Self}` as format argument
@@ -274,32 +282,41 @@ LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
 warning: there is no parameter `ItemContext` on trait `Baz`
   --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:44:49
    |
-LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}"
+LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}{This}"
    |                                                 ^^^^^^^^^^^
    |
    = help: expect either a generic argument name or `{Self}` as format argument
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
+warning: there is no parameter `This` on trait `Baz`
+  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:44:62
+   |
+LL |     label = "{float}{_Self}{crate_local}{Trait}{ItemContext}{This}"
+   |                                                              ^^^^
+   |
+   = help: expect either a generic argument name or `{Self}` as format argument
+   = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
+
 error[E0277]: {from_desugaring}{direct}{cause}{integral}{integer}
-  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:67:15
+  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:69:15
    |
 LL |     takes_baz(());
-   |     --------- ^^ {float}{_Self}{crate_local}{Trait}{ItemContext}
+   |     --------- ^^ {float}{_Self}{crate_local}{Trait}{ItemContext}{This}
    |     |
    |     required by a bound introduced by this call
    |
    = help: the trait `Baz` is not implemented for `()`
 help: this trait has no implementations, consider adding one
-  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:56:1
+  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:58:1
    |
 LL | trait Baz {}
    | ^^^^^^^^^
 note: required by a bound in `takes_baz`
-  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:60:22
+  --> $DIR/do_not_accept_options_of_the_internal_rustc_attribute.rs:62:22
    |
 LL | fn takes_baz(_: impl Baz) {}
    |                      ^^^ required by this bound in `takes_baz`
 
-error: aborting due to 3 previous errors; 29 warnings emitted
+error: aborting due to 3 previous errors; 31 warnings emitted
 
 For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs
index 8328c10d2a0..08eb5707e90 100644
--- a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.rs
@@ -14,11 +14,15 @@ struct Bar {}
 //~|WARN malformed `on_unimplemented` attribute
 trait Baz {}
 
-#[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
+#[diagnostic::on_unimplemented(message = "Boom", on(Self = "i32", message = "whatever"))]
 //~^WARN malformed `on_unimplemented` attribute
 //~|WARN malformed `on_unimplemented` attribute
 trait Boom {}
 
+#[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
+//~^WARN malformed `on_unimplemented` attribute
+trait _Self {}
+
 #[diagnostic::on_unimplemented = "boom"]
 //~^WARN malformed `on_unimplemented` attribute
 trait Doom {}
diff --git a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr
index 4dd8c1afca0..80790dc3f79 100644
--- a/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr
+++ b/tests/ui/diagnostic_namespace/on_unimplemented/do_not_fail_parsing_on_invalid_options_1.stderr
@@ -25,13 +25,21 @@ LL | #[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
 warning: malformed `on_unimplemented` attribute
   --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:17:50
    |
+LL | #[diagnostic::on_unimplemented(message = "Boom", on(Self = "i32", message = "whatever"))]
+   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
+   |
+   = help: only `message`, `note` and `label` are allowed as options
+
+warning: malformed `on_unimplemented` attribute
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:22:50
+   |
 LL | #[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
    |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
    |
    = help: only `message`, `note` and `label` are allowed as options
 
 warning: malformed `on_unimplemented` attribute
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:22:32
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:32
    |
 LL | #[diagnostic::on_unimplemented = "boom"]
    |                                ^^^^^^^^ invalid option found here
@@ -39,7 +47,7 @@ LL | #[diagnostic::on_unimplemented = "boom"]
    = help: only `message`, `note` and `label` are allowed as options
 
 warning: missing options for `on_unimplemented` attribute
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:1
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:30:1
    |
 LL | #[diagnostic::on_unimplemented]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -47,7 +55,7 @@ LL | #[diagnostic::on_unimplemented]
    = help: at least one of the `message`, `note` and `label` options are expected
 
 warning: there is no parameter `DoesNotExist` on trait `Test`
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:31:44
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:35:44
    |
 LL | #[diagnostic::on_unimplemented(message = "{DoesNotExist}")]
    |                                            ^^^^^^^^^^^^
@@ -64,7 +72,7 @@ LL | #[diagnostic::on_unimplemented(unsupported = "foo")]
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: the trait bound `i32: Foo` is not satisfied
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:43:14
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:47:14
    |
 LL |     take_foo(1_i32);
    |     -------- ^^^^^ the trait `Foo` is not implemented for `i32`
@@ -77,7 +85,7 @@ help: this trait has no implementations, consider adding one
 LL | trait Foo {}
    | ^^^^^^^^^
 note: required by a bound in `take_foo`
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:36:21
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:40:21
    |
 LL | fn take_foo(_: impl Foo) {}
    |                     ^^^ required by this bound in `take_foo`
@@ -92,7 +100,7 @@ LL | #[diagnostic::on_unimplemented(message = "Boom", unsupported = "Bar")]
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: Boom
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:45:14
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:49:14
    |
 LL |     take_baz(1_i32);
    |     -------- ^^^^^ the trait `Baz` is not implemented for `i32`
@@ -105,7 +113,7 @@ help: this trait has no implementations, consider adding one
 LL | trait Baz {}
    | ^^^^^^^^^
 note: required by a bound in `take_baz`
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:37:21
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:41:21
    |
 LL | fn take_baz(_: impl Baz) {}
    |                     ^^^ required by this bound in `take_baz`
@@ -113,14 +121,14 @@ LL | fn take_baz(_: impl Baz) {}
 warning: malformed `on_unimplemented` attribute
   --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:17:50
    |
-LL | #[diagnostic::on_unimplemented(message = "Boom", on(_Self = "i32", message = "whatever"))]
-   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
+LL | #[diagnostic::on_unimplemented(message = "Boom", on(Self = "i32", message = "whatever"))]
+   |                                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ invalid option found here
    |
    = help: only `message`, `note` and `label` are allowed as options
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: Boom
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:47:15
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:51:15
    |
 LL |     take_boom(1_i32);
    |     --------- ^^^^^ the trait `Boom` is not implemented for `i32`
@@ -133,13 +141,13 @@ help: this trait has no implementations, consider adding one
 LL | trait Boom {}
    | ^^^^^^^^^^
 note: required by a bound in `take_boom`
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:38:22
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:42:22
    |
 LL | fn take_boom(_: impl Boom) {}
    |                      ^^^^ required by this bound in `take_boom`
 
 warning: missing options for `on_unimplemented` attribute
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:26:1
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:30:1
    |
 LL | #[diagnostic::on_unimplemented]
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -148,7 +156,7 @@ LL | #[diagnostic::on_unimplemented]
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: the trait bound `i32: Whatever` is not satisfied
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:49:19
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:53:19
    |
 LL |     take_whatever(1_i32);
    |     ------------- ^^^^^ the trait `Whatever` is not implemented for `i32`
@@ -156,18 +164,18 @@ LL |     take_whatever(1_i32);
    |     required by a bound introduced by this call
    |
 help: this trait has no implementations, consider adding one
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:29:1
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:33:1
    |
 LL | trait Whatever {}
    | ^^^^^^^^^^^^^^
 note: required by a bound in `take_whatever`
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:39:26
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:43:26
    |
 LL | fn take_whatever(_: impl Whatever) {}
    |                          ^^^^^^^^ required by this bound in `take_whatever`
 
 warning: there is no parameter `DoesNotExist` on trait `Test`
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:31:44
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:35:44
    |
 LL | #[diagnostic::on_unimplemented(message = "{DoesNotExist}")]
    |                                            ^^^^^^^^^^^^
@@ -176,7 +184,7 @@ LL | #[diagnostic::on_unimplemented(message = "{DoesNotExist}")]
    = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
 
 error[E0277]: {DoesNotExist}
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:51:15
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:55:15
    |
 LL |     take_test(());
    |     --------- ^^ the trait `Test` is not implemented for `()`
@@ -184,16 +192,16 @@ LL |     take_test(());
    |     required by a bound introduced by this call
    |
 help: this trait has no implementations, consider adding one
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:34:1
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:38:1
    |
 LL | trait Test {}
    | ^^^^^^^^^^
 note: required by a bound in `take_test`
-  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:40:22
+  --> $DIR/do_not_fail_parsing_on_invalid_options_1.rs:44:22
    |
 LL | fn take_test(_: impl Test) {}
    |                      ^^^^ required by this bound in `take_test`
 
-error: aborting due to 5 previous errors; 12 warnings emitted
+error: aborting due to 5 previous errors; 13 warnings emitted
 
 For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/error-codes/E0223.stderr b/tests/ui/error-codes/E0223.stderr
index e985a4c9bf0..fbfdce5689a 100644
--- a/tests/ui/error-codes/E0223.stderr
+++ b/tests/ui/error-codes/E0223.stderr
@@ -2,7 +2,13 @@ error[E0223]: ambiguous associated type
   --> $DIR/E0223.rs:8:14
    |
 LL |     let foo: MyTrait::X;
-   |              ^^^^^^^^^^ help: use fully-qualified syntax: `<MyStruct as MyTrait>::X`
+   |              ^^^^^^^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL -     let foo: MyTrait::X;
+LL +     let foo: <MyStruct as MyTrait>::X;
+   |
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/lang-items/lang-item-generic-requirements.rs b/tests/ui/lang-items/lang-item-generic-requirements.rs
index 90ed5f3f0ef..7676b5557d2 100644
--- a/tests/ui/lang-items/lang-item-generic-requirements.rs
+++ b/tests/ui/lang-items/lang-item-generic-requirements.rs
@@ -49,12 +49,14 @@ fn ice() {
     // Use index
     let arr = [0; 5];
     let _ = arr[2];
+    //~^ ERROR cannot index into a value of type `[{integer}; 5]`
 
     // Use phantomdata
     let _ = MyPhantomData::<(), i32>;
 
     // Use Foo
     let _: () = Foo;
+    //~^ ERROR mismatched types
 }
 
 // use `start`
diff --git a/tests/ui/lang-items/lang-item-generic-requirements.stderr b/tests/ui/lang-items/lang-item-generic-requirements.stderr
index 3de67d65940..409fa05d637 100644
--- a/tests/ui/lang-items/lang-item-generic-requirements.stderr
+++ b/tests/ui/lang-items/lang-item-generic-requirements.stderr
@@ -76,9 +76,23 @@ LL |     r + a;
    |     |
    |     {integer}
 
+error[E0608]: cannot index into a value of type `[{integer}; 5]`
+  --> $DIR/lang-item-generic-requirements.rs:51:16
+   |
+LL |     let _ = arr[2];
+   |                ^^^
+
+error[E0308]: mismatched types
+  --> $DIR/lang-item-generic-requirements.rs:58:17
+   |
+LL |     let _: () = Foo;
+   |            --   ^^^ expected `()`, found `Foo`
+   |            |
+   |            expected due to this
+
 error: requires `copy` lang_item
 
-error: aborting due to 10 previous errors
+error: aborting due to 12 previous errors
 
-Some errors have detailed explanations: E0369, E0392, E0718.
-For more information about an error, try `rustc --explain E0369`.
+Some errors have detailed explanations: E0308, E0369, E0392, E0608, E0718.
+For more information about an error, try `rustc --explain E0308`.
diff --git a/tests/ui/lint/bare-trait-objects-path.stderr b/tests/ui/lint/bare-trait-objects-path.stderr
index fbb647c37c5..e611abd31f3 100644
--- a/tests/ui/lint/bare-trait-objects-path.stderr
+++ b/tests/ui/lint/bare-trait-objects-path.stderr
@@ -55,7 +55,13 @@ error[E0223]: ambiguous associated type
   --> $DIR/bare-trait-objects-path.rs:23:12
    |
 LL |     let _: Dyn::Ty;
-   |            ^^^^^^^ help: use fully-qualified syntax: `<dyn Dyn as Assoc>::Ty`
+   |            ^^^^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL -     let _: Dyn::Ty;
+LL +     let _: <dyn Dyn as Assoc>::Ty;
+   |
 
 error: aborting due to 1 previous error; 4 warnings emitted
 
diff --git a/tests/ui/on-unimplemented/bad-annotation.rs b/tests/ui/on-unimplemented/bad-annotation.rs
index 25de5978110..937e5b82da5 100644
--- a/tests/ui/on-unimplemented/bad-annotation.rs
+++ b/tests/ui/on-unimplemented/bad-annotation.rs
@@ -59,7 +59,7 @@ trait EmptyOn {}
 //~^^^ NOTE expected value here
 trait ExpectedPredicateInOn {}
 
-#[rustc_on_unimplemented(on(x = "y"), message = "y")]
+#[rustc_on_unimplemented(on(Self = "y"), message = "y")]
 trait OnWithoutDirectives {}
 
 #[rustc_on_unimplemented(on(from_desugaring, on(from_desugaring, message = "x")), message = "y")]
@@ -107,3 +107,13 @@ trait InvalidPredicate {}
 //~^ ERROR invalid flag in `on`-clause
 //~^^ NOTE expected one of the `crate_local`, `direct` or `from_desugaring` flags, not `something`
 trait InvalidFlag {}
+
+#[rustc_on_unimplemented(on(_Self = "y", message = "y"))]
+//~^ ERROR invalid name in `on`-clause
+//~^^ NOTE expected one of `cause`, `from_desugaring`, `Self` or any generic parameter of the trait, not `_Self`
+trait InvalidName {}
+
+#[rustc_on_unimplemented(on(abc = "y", message = "y"))]
+//~^ ERROR invalid name in `on`-clause
+//~^^ NOTE expected one of `cause`, `from_desugaring`, `Self` or any generic parameter of the trait, not `abc`
+trait InvalidName2 {}
diff --git a/tests/ui/on-unimplemented/bad-annotation.stderr b/tests/ui/on-unimplemented/bad-annotation.stderr
index 35b919c7b78..3fc54532774 100644
--- a/tests/ui/on-unimplemented/bad-annotation.stderr
+++ b/tests/ui/on-unimplemented/bad-annotation.stderr
@@ -125,7 +125,19 @@ error[E0232]: invalid flag in `on`-clause
 LL | #[rustc_on_unimplemented(on(something, message = "y"))]
    |                             ^^^^^^^^^ expected one of the `crate_local`, `direct` or `from_desugaring` flags, not `something`
 
-error: aborting due to 18 previous errors
+error[E0232]: invalid name in `on`-clause
+  --> $DIR/bad-annotation.rs:111:29
+   |
+LL | #[rustc_on_unimplemented(on(_Self = "y", message = "y"))]
+   |                             ^^^^^ expected one of `cause`, `from_desugaring`, `Self` or any generic parameter of the trait, not `_Self`
+
+error[E0232]: invalid name in `on`-clause
+  --> $DIR/bad-annotation.rs:116:29
+   |
+LL | #[rustc_on_unimplemented(on(abc = "y", message = "y"))]
+   |                             ^^^ expected one of `cause`, `from_desugaring`, `Self` or any generic parameter of the trait, not `abc`
+
+error: aborting due to 20 previous errors
 
 Some errors have detailed explanations: E0230, E0231, E0232.
 For more information about an error, try `rustc --explain E0230`.
diff --git a/tests/ui/on-unimplemented/on-trait.rs b/tests/ui/on-unimplemented/on-trait.rs
index 556813cd479..91630af17e9 100644
--- a/tests/ui/on-unimplemented/on-trait.rs
+++ b/tests/ui/on-unimplemented/on-trait.rs
@@ -3,7 +3,7 @@
 #![feature(rustc_attrs)]
 
 pub mod Bar {
-  #[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}` in `{Foo}`"]
+  #[rustc_on_unimplemented = "test error `{Self}` with `{Bar}` `{Baz}` `{Quux}` in `{This}`"]
   pub trait Foo<Bar, Baz, Quux> {}
 }
 
diff --git a/tests/ui/qualified/qualified-path-params-2.stderr b/tests/ui/qualified/qualified-path-params-2.stderr
index 6641e81013f..e70cdbdc3f4 100644
--- a/tests/ui/qualified/qualified-path-params-2.stderr
+++ b/tests/ui/qualified/qualified-path-params-2.stderr
@@ -7,7 +7,7 @@ LL | type A = <S as Tr>::A::f<u8>;
 help: if there were a trait named `Example` with associated type `f` implemented for `<S as Tr>::A`, you could use the fully-qualified path
    |
 LL - type A = <S as Tr>::A::f<u8>;
-LL + type A = <<S as Tr>::A as Example>::f;
+LL + type A = <<S as Tr>::A as Example>::f<u8>;
    |
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/repeat-expr/copy-check-const-element-uninferred-count.rs b/tests/ui/repeat-expr/copy-check-const-element-uninferred-count.rs
new file mode 100644
index 00000000000..6115146539c
--- /dev/null
+++ b/tests/ui/repeat-expr/copy-check-const-element-uninferred-count.rs
@@ -0,0 +1,72 @@
+#![feature(generic_arg_infer)]
+
+// Test when deferring repeat expr copy checks to end of typechecking whether elements
+// that are const items allow for repeat counts to go uninferred without an error being
+// emitted if they would later wind up inferred by integer fallback.
+//
+// This test should be updated if we wind up deferring repeat expr checks until *after*
+// integer fallback as the point of the test is not *specifically* about integer fallback
+// but rather about the behaviour of `const` element exprs.
+
+trait Trait<const N: usize> {}
+
+// We impl `Trait` for both `i32` and `u32` to avoid being able
+// to prove `?int: Trait<?n>` from there only being one impl.
+impl Trait<2> for i32 {}
+impl Trait<2> for u32 {}
+
+fn tie_and_make_goal<const N: usize, T: Trait<N>>(_: &T, _: &[String; N]) {}
+
+fn const_block() {
+    // Deferred repeat expr `String; ?n`
+    let a = [const { String::new() }; _];
+
+    // `?int: Trait<?n>` goal
+    tie_and_make_goal(&1, &a);
+
+    // If repeat expr checks structurally resolve the `?n`s before checking if the
+    // element is a `const` then we would error here. Otherwise we avoid doing so,
+    // integer fallback occurs, allowing `?int: Trait<?n>` goals to make progress,
+    // inferring the repeat counts (to `2` but that doesn't matter as the element is `const`).
+}
+
+fn const_item() {
+    const MY_CONST: String = String::new();
+
+    // Deferred repeat expr `String; ?n`
+    let a = [MY_CONST; _];
+
+    // `?int: Trait<?n>` goal
+    tie_and_make_goal(&1, &a);
+
+    // ... same as `const_block`
+}
+
+fn assoc_const() {
+    trait Dummy {
+        const ASSOC: String;
+    }
+    impl Dummy for () {
+        const ASSOC: String = String::new();
+    }
+
+    // Deferred repeat expr `String; ?n`
+    let a = [<() as Dummy>::ASSOC; _];
+
+    // `?int: Trait<?n>` goal
+    tie_and_make_goal(&1, &a);
+
+    // ... same as `const_block`
+}
+
+fn const_block_but_uninferred() {
+    // Deferred repeat expr `String; ?n`
+    let a = [const { String::new() }; _];
+    //~^ ERROR: type annotations needed for `[String; _]`
+
+    // Even if we don't structurally resolve the repeat count as part of repeat expr
+    // checks, we still error on the repeat count being uninferred as we require all
+    // types/consts to be inferred by the end of type checking.
+}
+
+fn main() {}
diff --git a/tests/ui/repeat-expr/copy-check-const-element-uninferred-count.stderr b/tests/ui/repeat-expr/copy-check-const-element-uninferred-count.stderr
new file mode 100644
index 00000000000..2f52537fa94
--- /dev/null
+++ b/tests/ui/repeat-expr/copy-check-const-element-uninferred-count.stderr
@@ -0,0 +1,15 @@
+error[E0284]: type annotations needed for `[String; _]`
+  --> $DIR/copy-check-const-element-uninferred-count.rs:64:9
+   |
+LL |     let a = [const { String::new() }; _];
+   |         ^   ---------------------------- type must be known at this point
+   |
+   = note: the length of array `[String; _]` must be type `usize`
+help: consider giving `a` an explicit type, where the placeholders `_` are specified
+   |
+LL |     let a: [_; _] = [const { String::new() }; _];
+   |          ++++++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0284`.
diff --git a/tests/ui/repeat-expr/copy-check-deferred-after-fallback.rs b/tests/ui/repeat-expr/copy-check-deferred-after-fallback.rs
index d9ad93541ec..3f310f07de0 100644
--- a/tests/ui/repeat-expr/copy-check-deferred-after-fallback.rs
+++ b/tests/ui/repeat-expr/copy-check-deferred-after-fallback.rs
@@ -1,37 +1,53 @@
 #![feature(generic_arg_infer)]
 
-// Test that would start passing if we defer repeat expr copy checks to end of
-// typechecking and they're checked after integer fallback occurs. We accomplish
-// this by contriving a situation where integer fallback allows progress to be
-// made on a trait goal that infers the length of a repeat expr.
+// Test when deferring repeat expr copy checks to end of typechecking whether they're
+// checked before integer fallback occurs or not. We accomplish this by having a repeat
+// count that can only be inferred after integer fallback has occured. This test will
+// pass if we were to check repeat exprs after integer fallback.
 
 use std::marker::PhantomData;
-
-struct NotCopy;
+struct Foo<T>(PhantomData<T>);
+
+// We impl Copy/Clone for multiple (but not all) substitutions
+// to ensure that `Foo<?int>: Copy` can't be proven on the basis
+// of there only being one applying impl.
+impl Clone for Foo<u32> {
+    fn clone(&self) -> Self {
+        Foo(PhantomData)
+    }
+}
+impl Clone for Foo<i32> {
+    fn clone(&self) -> Self {
+        Foo(PhantomData)
+    }
+}
+impl Copy for Foo<u32> {}
+impl Copy for Foo<i32> {}
 
 trait Trait<const N: usize> {}
 
-impl Trait<2> for u32 {}
+// We impl `Trait` for both `i32` and `u32` to avoid being able
+// to prove `?int: Trait<?n>` from there only being one impl.
 impl Trait<1> for i32 {}
+impl Trait<2> for u32 {}
 
-fn make_goal<T: Trait<N>, const N: usize>(_: &T, _: [NotCopy; N]) {}
+fn tie_and_make_goal<const N: usize, T: Trait<N>>(_: &T, _: &[Foo<T>; N]) {}
 
 fn main() {
     let a = 1;
-    let b = [NotCopy; _];
-    //~^ ERROR: type annotations needed
-
-    // a is of type `?y`
-    // b is of type `[NotCopy; ?x]`
-    // there is a goal ?y: Trait<?x>` with two candidates:
-    // - `i32: Trait<1>`, ?y=i32 ?x=1 which doesnt require `NotCopy: Copy`
-    // - `u32: Trait<2>` ?y=u32 ?x=2 which requires `NotCopy: Copy`
-    make_goal(&a, b);
-
-    // final repeat expr checks:
-    //
-    // `NotCopy; ?x`
-    // - succeeds if fallback happens before repeat exprs as `i32: Trait<?x>` infers `?x=1`
-    // - fails if repeat expr checks happen first as `?x` is unconstrained so cannot be
-    //    structurally resolved
+    // Deferred repeat expr `Foo<?int>; ?n`
+    let b = [Foo(PhantomData); _];
+    //~^ ERROR: type annotations needed for `[Foo<{integer}>; _]`
+
+    // Introduces a `?int: Trait<?n>` goal
+    tie_and_make_goal(&a, &b);
+
+    // If fallback doesn't occur:
+    // - `Foo<?int>; ?n`is ambig as repeat count is unknown -> error
+
+    // If fallback occurs:
+    // - `?int` inferred to `i32`
+    // - `?int: Trait<?n>` becomes `i32: Trait<?n>` wihhc infers `?n=1`
+    // - Repeat expr check `Foo<?int>; ?n` is now `Foo<i32>; 1`
+    // - `Foo<i32>; 1` doesn't require `Foo<i32>: Copy`
 }
diff --git a/tests/ui/repeat-expr/copy-check-deferred-after-fallback.stderr b/tests/ui/repeat-expr/copy-check-deferred-after-fallback.stderr
index 2a0cb3fb7a3..103b074dda7 100644
--- a/tests/ui/repeat-expr/copy-check-deferred-after-fallback.stderr
+++ b/tests/ui/repeat-expr/copy-check-deferred-after-fallback.stderr
@@ -1,13 +1,13 @@
-error[E0282]: type annotations needed for `[NotCopy; _]`
-  --> $DIR/copy-check-deferred-after-fallback.rs:21:9
+error[E0282]: type annotations needed for `[Foo<{integer}>; _]`
+  --> $DIR/copy-check-deferred-after-fallback.rs:39:9
    |
-LL |     let b = [NotCopy; _];
-   |         ^    ------- type must be known at this point
+LL |     let b = [Foo(PhantomData); _];
+   |         ^    ---------------- type must be known at this point
    |
 help: consider giving `b` an explicit type, where the value of const parameter `N` is specified
    |
-LL |     let b: [_; N] = [NotCopy; _];
-   |          ++++++++
+LL |     let b: [Foo<{integer}>; N] = [Foo(PhantomData); _];
+   |          +++++++++++++++++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/repeat-expr/copy-check-deferred-before-fallback.rs b/tests/ui/repeat-expr/copy-check-deferred-before-fallback.rs
index 4654d7483a6..4fbb8f0a00c 100644
--- a/tests/ui/repeat-expr/copy-check-deferred-before-fallback.rs
+++ b/tests/ui/repeat-expr/copy-check-deferred-before-fallback.rs
@@ -1,18 +1,13 @@
 //@ check-pass
-
 #![feature(generic_arg_infer)]
 
-// Test that if we defer repeat expr copy checks to end of typechecking they're
-// checked before integer fallback occurs. We accomplish this by contriving a
-// situation where we have a goal that can be proven either via another repeat expr
-// check or by integer fallback. In the integer fallback case an array length would
-// be inferred to `2` requiring `NotCopy: Copy`, and in the repeat expr case it would
-// be inferred to `1`.
+// Test when deferring repeat expr checks to end of typechecking whether they're
+// checked before integer fallback occurs. We accomplish this by having the repeat
+// expr check allow inference progress on an ambiguous goal, where the ambiguous goal
+// would fail if the inference variable was fallen back to `i32`. This test will
+// pass if we check repeat exprs before integer fallback.
 
 use std::marker::PhantomData;
-
-struct NotCopy;
-
 struct Foo<T>(PhantomData<T>);
 
 impl Clone for Foo<u32> {
@@ -20,40 +15,34 @@ impl Clone for Foo<u32> {
         Foo(PhantomData)
     }
 }
-
 impl Copy for Foo<u32> {}
 
-fn tie<T>(_: &T, _: [Foo<T>; 2]) {}
+trait Trait {}
 
-trait Trait<const N: usize> {}
+// Two impls just to ensure that `?int: Trait` wont itself succeed by unifying with
+// a self type on an impl here. It also ensures that integer fallback would actually
+// be valid for all of the stalled goals incase that's ever something we take into account.
+impl Trait for i32 {}
+impl Trait for u32 {}
 
-impl Trait<2> for i32 {}
-impl Trait<1> for u32 {}
-
-fn make_goal<T: Trait<N>, const N: usize>(_: &T, _: [NotCopy; N]) {}
+fn make_goal<T: Trait>(_: &T) {}
+fn tie<T>(_: &T, _: &[Foo<T>; 2]) {}
 
 fn main() {
     let a = 1;
+    // `?int: Trait`
+    make_goal(&a);
+
+    // Deferred `Foo<?int>: Copy` requirement
     let b: [Foo<_>; 2] = [Foo(PhantomData); _];
-    tie(&a, b);
-    let c = [NotCopy; _];
-
-    // a is of type `?y`
-    // b is of type `[Foo<?y>; 2]`
-    // c is of type `[NotCopy; ?x]`
-    // there is a goal ?y: Trait<?x>` with two candidates:
-    // - `i32: Trait<2>`, ?y=i32 ?x=2 which requires `NotCopy: Copy` when expr checks happen
-    // - `u32: Trait<1>` ?y=u32 ?x=1 which doesnt require `NotCopy: Copy`
-    make_goal(&a, c);
-
-    // final repeat expr checks:
-    //
-    // `Foo<?y>; 2`
-    // - Foo<?y>: Copy
-    // - requires ?y=u32
-    //
-    // `NotCopy; ?x`
-    // - fails if fallback happens before repeat exprs as `i32: Trait<?x>` infers `?x=2`
-    // - succeeds if repeat expr checks happen first as `?y=u32` means `u32: Trait<?x>`
-    //    infers `?x=1`
+    tie(&a, &b);
+
+    // If fallback doesn't occur:
+    // - `Foo<?int>; 2`is > 1, needs copy
+    // - `Foo<?int>: Copy` infers `?int=u32`
+    // - stalled goal `?int: Trait` can now make progress and succeed
+
+    // If fallback occurs:
+    // - `Foo<i32>; 2` is > 1, needs copy
+    // - `Foo<i32>: Copy` doesn't hold -> error
 }
diff --git a/tests/ui/repeat-expr/copy-check-inference-side-effects.rs b/tests/ui/repeat-expr/copy-check-inference-side-effects.rs
new file mode 100644
index 00000000000..4e3bfdead26
--- /dev/null
+++ b/tests/ui/repeat-expr/copy-check-inference-side-effects.rs
@@ -0,0 +1,34 @@
+#![feature(generic_arg_infer)]
+
+struct Foo<const N: usize>;
+
+impl Clone for Foo<1> {
+    fn clone(&self) -> Self {
+        Self
+    }
+}
+impl Copy for Foo<1> {}
+
+fn unify<const N: usize>(_: &[Foo<N>; 2], _: &[String; N]) {}
+
+fn works_if_inference_side_effects() {
+    // This will only pass if inference side effects from proving `Foo<?x>: Copy` are
+    // able to be relied upon by other repeat expressions.
+    let a /* : [Foo<?x>; 2] */ = [Foo::<_>; 2];
+    //~^ ERROR: type annotations needed for `[Foo<_>; 2]`
+    let b /* : [String; ?x] */ = ["string".to_string(); _];
+
+    unify(&a, &b);
+}
+
+fn works_if_fixed_point() {
+    // This will only pass if the *second* array repeat expr is checked first
+    // allowing `Foo<?x>: Copy` to infer the array length of the first repeat expr.
+    let b /* : [String; ?x] */ = ["string".to_string(); _];
+    //~^ ERROR: type annotations needed for `[String; _]`
+    let a /* : [Foo<?x>; 2] */ = [Foo::<_>; 2];
+
+    unify(&a, &b);
+}
+
+fn main() {}
diff --git a/tests/ui/repeat-expr/copy-check-inference-side-effects.stderr b/tests/ui/repeat-expr/copy-check-inference-side-effects.stderr
new file mode 100644
index 00000000000..505beff0f6b
--- /dev/null
+++ b/tests/ui/repeat-expr/copy-check-inference-side-effects.stderr
@@ -0,0 +1,28 @@
+error[E0282]: type annotations needed for `[Foo<_>; 2]`
+  --> $DIR/copy-check-inference-side-effects.rs:17:9
+   |
+LL |     let a /* : [Foo<?x>; 2] */ = [Foo::<_>; 2];
+   |         ^
+LL |
+LL |     let b /* : [String; ?x] */ = ["string".to_string(); _];
+   |                                   -------------------- type must be known at this point
+   |
+help: consider giving `a` an explicit type, where the value of const parameter `N` is specified
+   |
+LL |     let a: [Foo<N>; 2] /* : [Foo<?x>; 2] */ = [Foo::<_>; 2];
+   |          +++++++++++++
+
+error[E0282]: type annotations needed for `[String; _]`
+  --> $DIR/copy-check-inference-side-effects.rs:27:9
+   |
+LL |     let b /* : [String; ?x] */ = ["string".to_string(); _];
+   |         ^                         -------------------- type must be known at this point
+   |
+help: consider giving `b` an explicit type, where the value of const parameter `N` is specified
+   |
+LL |     let b: [_; N] /* : [String; ?x] */ = ["string".to_string(); _];
+   |          ++++++++
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.rs b/tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.rs
index 0b0672d9c2b..d50466ac4bb 100644
--- a/tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.rs
+++ b/tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.rs
@@ -1,8 +1,3 @@
-//@revisions: current gai
-//@[current] check-pass
-
-#![cfg_attr(gai, feature(generic_arg_infer))]
-
 use std::marker::PhantomData;
 
 struct Foo<T>(PhantomData<T>);
@@ -20,6 +15,6 @@ fn extract<T, const N: usize>(_: [Foo<T>; N]) -> T {
 
 fn main() {
     let x = [Foo(PhantomData); 2];
-    //[gai]~^ ERROR: type annotations needed
-    _ = extract(x).max(2);
+    //~^ ERROR: type annotations needed
+    extract(x).max(2);
 }
diff --git a/tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.stderr b/tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.stderr
new file mode 100644
index 00000000000..ba44beb76db
--- /dev/null
+++ b/tests/ui/repeat-expr/copy-inference-side-effects-are-lazy.stderr
@@ -0,0 +1,17 @@
+error[E0282]: type annotations needed for `[Foo<_>; 2]`
+  --> $DIR/copy-inference-side-effects-are-lazy.rs:17:9
+   |
+LL |     let x = [Foo(PhantomData); 2];
+   |         ^
+LL |
+LL |     extract(x).max(2);
+   |     ---------- type must be known at this point
+   |
+help: consider giving `x` an explicit type, where the type for type parameter `T` is specified
+   |
+LL |     let x: [Foo<T>; 2] = [Foo(PhantomData); 2];
+   |          +++++++++++++
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/tests/ui/self/self-impl.stderr b/tests/ui/self/self-impl.stderr
index 18ffd15427f..1bda307d0eb 100644
--- a/tests/ui/self/self-impl.stderr
+++ b/tests/ui/self/self-impl.stderr
@@ -2,13 +2,25 @@ error[E0223]: ambiguous associated type
   --> $DIR/self-impl.rs:23:16
    |
 LL |         let _: <Self>::Baz = true;
-   |                ^^^^^^^^^^^ help: use fully-qualified syntax: `<Bar as Foo>::Baz`
+   |                ^^^^^^^^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL -         let _: <Self>::Baz = true;
+LL +         let _: <Bar as Foo>::Baz = true;
+   |
 
 error[E0223]: ambiguous associated type
   --> $DIR/self-impl.rs:25:16
    |
 LL |         let _: Self::Baz = true;
-   |                ^^^^^^^^^ help: use fully-qualified syntax: `<Bar as Foo>::Baz`
+   |                ^^^^^^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL -         let _: Self::Baz = true;
+LL +         let _: <Bar as Foo>::Baz = true;
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/structs/struct-path-associated-type.stderr b/tests/ui/structs/struct-path-associated-type.stderr
index de396e875b0..110362293ac 100644
--- a/tests/ui/structs/struct-path-associated-type.stderr
+++ b/tests/ui/structs/struct-path-associated-type.stderr
@@ -48,19 +48,37 @@ error[E0223]: ambiguous associated type
   --> $DIR/struct-path-associated-type.rs:32:13
    |
 LL |     let s = S::A {};
-   |             ^^^^ help: use fully-qualified syntax: `<S as Tr>::A`
+   |             ^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL -     let s = S::A {};
+LL +     let s = <S as Tr>::A {};
+   |
 
 error[E0223]: ambiguous associated type
   --> $DIR/struct-path-associated-type.rs:33:13
    |
 LL |     let z = S::A::<u8> {};
-   |             ^^^^ help: use fully-qualified syntax: `<S as Tr>::A`
+   |             ^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL -     let z = S::A::<u8> {};
+LL +     let z = <S as Tr>::A::<u8> {};
+   |
 
 error[E0223]: ambiguous associated type
   --> $DIR/struct-path-associated-type.rs:35:9
    |
 LL |         S::A {} => {}
-   |         ^^^^ help: use fully-qualified syntax: `<S as Tr>::A`
+   |         ^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL -         S::A {} => {}
+LL +         <S as Tr>::A {} => {}
+   |
 
 error: aborting due to 8 previous errors
 
diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr
index 4fd9ef91192..1d3d8cb9843 100644
--- a/tests/ui/traits/item-privacy.stderr
+++ b/tests/ui/traits/item-privacy.stderr
@@ -230,13 +230,25 @@ error[E0223]: ambiguous associated type
   --> $DIR/item-privacy.rs:119:12
    |
 LL |     let _: S::B;
-   |            ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::B>::B`
+   |            ^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL -     let _: S::B;
+LL +     let _: <S as assoc_ty::B>::B;
+   |
 
 error[E0223]: ambiguous associated type
   --> $DIR/item-privacy.rs:120:12
    |
 LL |     let _: S::C;
-   |            ^^^^ help: use fully-qualified syntax: `<S as assoc_ty::C>::C`
+   |            ^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL -     let _: S::C;
+LL +     let _: <S as assoc_ty::C>::C;
+   |
 
 error[E0624]: associated type `A` is private
   --> $DIR/item-privacy.rs:122:12
diff --git a/tests/ui/transmute/unnecessary-transmutation.fixed b/tests/ui/transmute/unnecessary-transmutation.fixed
index f6478c5aa5c..08010ec8b84 100644
--- a/tests/ui/transmute/unnecessary-transmutation.fixed
+++ b/tests/ui/transmute/unnecessary-transmutation.fixed
@@ -8,7 +8,27 @@ pub fn bytes_at_home(x: u32) -> [u8; 4] {
     //~^ ERROR
 }
 
+pub const fn intinator_const(from: bool) -> u8 {
+    unsafe { (from) as u8 }
+    //~^ ERROR
+}
+
+pub static X: u8 = unsafe { (true) as u8 };
+//~^ ERROR
+pub const Y: u8 = unsafe { (true) as u8 };
+//~^ ERROR
+
+pub struct Z {}
+impl Z {
+    pub const fn intinator_assoc(x: bool) -> u8 {
+        unsafe { (x) as u8 }
+        //~^ ERROR
+    }
+}
+
 fn main() {
+    const { unsafe { (true) as u8 } };
+    //~^ ERROR
     unsafe {
         let x: u16 = u16::from_ne_bytes(*b"01");
         //~^ ERROR
@@ -83,12 +103,12 @@ fn main() {
 
         let z: bool = transmute(1u8);
         // clippy
-        let z: u8 = (z) as u8;
+        let z: u8 = u8::from(z);
         //~^ ERROR
 
         let z: bool = transmute(1i8);
         // clippy
-        let z: i8 = (z) as i8;
+        let z: i8 = i8::from(z);
         //~^ ERROR
     }
 }
diff --git a/tests/ui/transmute/unnecessary-transmutation.rs b/tests/ui/transmute/unnecessary-transmutation.rs
index ab0af03acc2..43eefb97dc2 100644
--- a/tests/ui/transmute/unnecessary-transmutation.rs
+++ b/tests/ui/transmute/unnecessary-transmutation.rs
@@ -8,7 +8,27 @@ pub fn bytes_at_home(x: u32) -> [u8; 4] {
     //~^ ERROR
 }
 
+pub const fn intinator_const(from: bool) -> u8 {
+    unsafe { transmute(from) }
+    //~^ ERROR
+}
+
+pub static X: u8 = unsafe { transmute(true) };
+//~^ ERROR
+pub const Y: u8 = unsafe { transmute(true) };
+//~^ ERROR
+
+pub struct Z {}
+impl Z {
+    pub const fn intinator_assoc(x: bool) -> u8 {
+        unsafe { transmute(x) }
+        //~^ ERROR
+    }
+}
+
 fn main() {
+    const { unsafe { transmute::<_, u8>(true) } };
+    //~^ ERROR
     unsafe {
         let x: u16 = transmute(*b"01");
         //~^ ERROR
diff --git a/tests/ui/transmute/unnecessary-transmutation.stderr b/tests/ui/transmute/unnecessary-transmutation.stderr
index 59e933bbc81..602e964f5b2 100644
--- a/tests/ui/transmute/unnecessary-transmutation.stderr
+++ b/tests/ui/transmute/unnecessary-transmutation.stderr
@@ -1,10 +1,9 @@
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:7:14
+  --> $DIR/unnecessary-transmutation.rs:16:29
    |
-LL |     unsafe { transmute(x) }
-   |              ^^^^^^^^^^^^ help: replace this with: `u32::to_ne_bytes(x)`
+LL | pub static X: u8 = unsafe { transmute(true) };
+   |                             ^^^^^^^^^^^^^^^ help: replace this with: `(true) as u8`
    |
-   = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order
 note: the lint level is defined here
   --> $DIR/unnecessary-transmutation.rs:2:9
    |
@@ -12,7 +11,33 @@ LL | #![deny(unnecessary_transmutes)]
    |         ^^^^^^^^^^^^^^^^^^^^^^
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:13:22
+  --> $DIR/unnecessary-transmutation.rs:18:28
+   |
+LL | pub const Y: u8 = unsafe { transmute(true) };
+   |                            ^^^^^^^^^^^^^^^ help: replace this with: `(true) as u8`
+
+error: unnecessary transmute
+  --> $DIR/unnecessary-transmutation.rs:7:14
+   |
+LL |     unsafe { transmute(x) }
+   |              ^^^^^^^^^^^^ help: replace this with: `u32::to_ne_bytes(x)`
+   |
+   = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order
+
+error: unnecessary transmute
+  --> $DIR/unnecessary-transmutation.rs:12:14
+   |
+LL |     unsafe { transmute(from) }
+   |              ^^^^^^^^^^^^^^^ help: replace this with: `(from) as u8`
+
+error: unnecessary transmute
+  --> $DIR/unnecessary-transmutation.rs:24:18
+   |
+LL |         unsafe { transmute(x) }
+   |                  ^^^^^^^^^^^^ help: replace this with: `(x) as u8`
+
+error: unnecessary transmute
+  --> $DIR/unnecessary-transmutation.rs:33:22
    |
 LL |         let x: u16 = transmute(*b"01");
    |                      ^^^^^^^^^^^^^^^^^ help: replace this with: `u16::from_ne_bytes(*b"01")`
@@ -20,7 +45,7 @@ LL |         let x: u16 = transmute(*b"01");
    = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:15:26
+  --> $DIR/unnecessary-transmutation.rs:35:26
    |
 LL |         let x: [u8; 2] = transmute(x);
    |                          ^^^^^^^^^^^^ help: replace this with: `u16::to_ne_bytes(x)`
@@ -28,7 +53,7 @@ LL |         let x: [u8; 2] = transmute(x);
    = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:17:22
+  --> $DIR/unnecessary-transmutation.rs:37:22
    |
 LL |         let x: u32 = transmute(*b"0123");
    |                      ^^^^^^^^^^^^^^^^^^^ help: replace this with: `u32::from_ne_bytes(*b"0123")`
@@ -36,7 +61,7 @@ LL |         let x: u32 = transmute(*b"0123");
    = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:19:26
+  --> $DIR/unnecessary-transmutation.rs:39:26
    |
 LL |         let x: [u8; 4] = transmute(x);
    |                          ^^^^^^^^^^^^ help: replace this with: `u32::to_ne_bytes(x)`
@@ -44,7 +69,7 @@ LL |         let x: [u8; 4] = transmute(x);
    = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:21:22
+  --> $DIR/unnecessary-transmutation.rs:41:22
    |
 LL |         let x: u64 = transmute(*b"feriscat");
    |                      ^^^^^^^^^^^^^^^^^^^^^^^ help: replace this with: `u64::from_ne_bytes(*b"feriscat")`
@@ -52,7 +77,7 @@ LL |         let x: u64 = transmute(*b"feriscat");
    = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:23:26
+  --> $DIR/unnecessary-transmutation.rs:43:26
    |
 LL |         let x: [u8; 8] = transmute(x);
    |                          ^^^^^^^^^^^^ help: replace this with: `u64::to_ne_bytes(x)`
@@ -60,7 +85,7 @@ LL |         let x: [u8; 8] = transmute(x);
    = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:26:22
+  --> $DIR/unnecessary-transmutation.rs:46:22
    |
 LL |         let y: i16 = transmute(*b"01");
    |                      ^^^^^^^^^^^^^^^^^ help: replace this with: `i16::from_ne_bytes(*b"01")`
@@ -68,7 +93,7 @@ LL |         let y: i16 = transmute(*b"01");
    = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:28:26
+  --> $DIR/unnecessary-transmutation.rs:48:26
    |
 LL |         let y: [u8; 2] = transmute(y);
    |                          ^^^^^^^^^^^^ help: replace this with: `i16::to_ne_bytes(y)`
@@ -76,7 +101,7 @@ LL |         let y: [u8; 2] = transmute(y);
    = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:30:22
+  --> $DIR/unnecessary-transmutation.rs:50:22
    |
 LL |         let y: i32 = transmute(*b"0123");
    |                      ^^^^^^^^^^^^^^^^^^^ help: replace this with: `i32::from_ne_bytes(*b"0123")`
@@ -84,7 +109,7 @@ LL |         let y: i32 = transmute(*b"0123");
    = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:32:26
+  --> $DIR/unnecessary-transmutation.rs:52:26
    |
 LL |         let y: [u8; 4] = transmute(y);
    |                          ^^^^^^^^^^^^ help: replace this with: `i32::to_ne_bytes(y)`
@@ -92,7 +117,7 @@ LL |         let y: [u8; 4] = transmute(y);
    = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:34:22
+  --> $DIR/unnecessary-transmutation.rs:54:22
    |
 LL |         let y: i64 = transmute(*b"feriscat");
    |                      ^^^^^^^^^^^^^^^^^^^^^^^ help: replace this with: `i64::from_ne_bytes(*b"feriscat")`
@@ -100,7 +125,7 @@ LL |         let y: i64 = transmute(*b"feriscat");
    = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:36:26
+  --> $DIR/unnecessary-transmutation.rs:56:26
    |
 LL |         let y: [u8; 8] = transmute(y);
    |                          ^^^^^^^^^^^^ help: replace this with: `i64::to_ne_bytes(y)`
@@ -108,7 +133,7 @@ LL |         let y: [u8; 8] = transmute(y);
    = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:39:22
+  --> $DIR/unnecessary-transmutation.rs:59:22
    |
 LL |         let z: f32 = transmute(*b"0123");
    |                      ^^^^^^^^^^^^^^^^^^^ help: replace this with: `f32::from_ne_bytes(*b"0123")`
@@ -116,7 +141,7 @@ LL |         let z: f32 = transmute(*b"0123");
    = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:41:26
+  --> $DIR/unnecessary-transmutation.rs:61:26
    |
 LL |         let z: [u8; 4] = transmute(z);
    |                          ^^^^^^^^^^^^ help: replace this with: `f32::to_ne_bytes(z)`
@@ -124,7 +149,7 @@ LL |         let z: [u8; 4] = transmute(z);
    = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:43:22
+  --> $DIR/unnecessary-transmutation.rs:63:22
    |
 LL |         let z: f64 = transmute(*b"feriscat");
    |                      ^^^^^^^^^^^^^^^^^^^^^^^ help: replace this with: `f64::from_ne_bytes(*b"feriscat")`
@@ -132,7 +157,7 @@ LL |         let z: f64 = transmute(*b"feriscat");
    = help: there's also `from_le_bytes` and `from_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:45:26
+  --> $DIR/unnecessary-transmutation.rs:65:26
    |
 LL |         let z: [u8; 8] = transmute(z);
    |                          ^^^^^^^^^^^^ help: replace this with: `f64::to_ne_bytes(z)`
@@ -140,13 +165,13 @@ LL |         let z: [u8; 8] = transmute(z);
    = help: there's also `to_le_bytes` and `to_be_bytes` if you expect a particular byte order
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:48:22
+  --> $DIR/unnecessary-transmutation.rs:68:22
    |
 LL |         let y: u32 = transmute('🦀');
    |                      ^^^^^^^^^^^^^^^ help: replace this with: `u32::from('🦀')`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:50:23
+  --> $DIR/unnecessary-transmutation.rs:70:23
    |
 LL |         let y: char = transmute(y);
    |                       ^^^^^^^^^^^^ help: replace this with: `char::from_u32_unchecked(y)`
@@ -154,13 +179,13 @@ LL |         let y: char = transmute(y);
    = help: consider `char::from_u32(…).unwrap()`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:52:22
+  --> $DIR/unnecessary-transmutation.rs:72:22
    |
 LL |         let y: i32 = transmute('🐱');
    |                      ^^^^^^^^^^^^^^^ help: replace this with: `u32::from('🐱').cast_signed()`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:54:23
+  --> $DIR/unnecessary-transmutation.rs:74:23
    |
 LL |         let y: char = transmute(y);
    |                       ^^^^^^^^^^^^ help: replace this with: `char::from_u32_unchecked(i32::cast_unsigned(y))`
@@ -168,88 +193,94 @@ LL |         let y: char = transmute(y);
    = help: consider `char::from_u32(i32::cast_unsigned(…)).unwrap()`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:57:22
+  --> $DIR/unnecessary-transmutation.rs:77:22
    |
 LL |         let x: u16 = transmute(8i16);
    |                      ^^^^^^^^^^^^^^^ help: replace this with: `i16::cast_unsigned(8i16)`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:59:22
+  --> $DIR/unnecessary-transmutation.rs:79:22
    |
 LL |         let x: i16 = transmute(x);
    |                      ^^^^^^^^^^^^ help: replace this with: `u16::cast_signed(x)`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:61:22
+  --> $DIR/unnecessary-transmutation.rs:81:22
    |
 LL |         let x: u32 = transmute(4i32);
    |                      ^^^^^^^^^^^^^^^ help: replace this with: `i32::cast_unsigned(4i32)`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:63:22
+  --> $DIR/unnecessary-transmutation.rs:83:22
    |
 LL |         let x: i32 = transmute(x);
    |                      ^^^^^^^^^^^^ help: replace this with: `u32::cast_signed(x)`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:65:22
+  --> $DIR/unnecessary-transmutation.rs:85:22
    |
 LL |         let x: u64 = transmute(7i64);
    |                      ^^^^^^^^^^^^^^^ help: replace this with: `i64::cast_unsigned(7i64)`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:67:22
+  --> $DIR/unnecessary-transmutation.rs:87:22
    |
 LL |         let x: i64 = transmute(x);
    |                      ^^^^^^^^^^^^ help: replace this with: `u64::cast_signed(x)`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:70:22
+  --> $DIR/unnecessary-transmutation.rs:90:22
    |
 LL |         let y: f32 = transmute(1u32);
    |                      ^^^^^^^^^^^^^^^ help: replace this with: `f32::from_bits(1u32)`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:72:22
+  --> $DIR/unnecessary-transmutation.rs:92:22
    |
 LL |         let y: u32 = transmute(y);
    |                      ^^^^^^^^^^^^ help: replace this with: `f32::to_bits(y)`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:74:22
+  --> $DIR/unnecessary-transmutation.rs:94:22
    |
 LL |         let y: f64 = transmute(3u64);
    |                      ^^^^^^^^^^^^^^^ help: replace this with: `f64::from_bits(3u64)`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:76:22
+  --> $DIR/unnecessary-transmutation.rs:96:22
    |
 LL |         let y: u64 = transmute(2.0);
    |                      ^^^^^^^^^^^^^^ help: replace this with: `f64::to_bits(2.0)`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:79:22
+  --> $DIR/unnecessary-transmutation.rs:99:22
    |
 LL |         let y: f64 = transmute(1i64);
    |                      ^^^^^^^^^^^^^^^ help: replace this with: `f64::from_bits(i64::cast_unsigned(1i64))`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:81:22
+  --> $DIR/unnecessary-transmutation.rs:101:22
    |
 LL |         let y: i64 = transmute(1f64);
    |                      ^^^^^^^^^^^^^^^ help: replace this with: `f64::to_bits(1f64).cast_signed()`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:86:21
+  --> $DIR/unnecessary-transmutation.rs:106:21
    |
 LL |         let z: u8 = transmute(z);
-   |                     ^^^^^^^^^^^^ help: replace this with: `(z) as u8`
+   |                     ^^^^^^^^^^^^ help: replace this with: `u8::from(z)`
 
 error: unnecessary transmute
-  --> $DIR/unnecessary-transmutation.rs:91:21
+  --> $DIR/unnecessary-transmutation.rs:111:21
    |
 LL |         let z: i8 = transmute(z);
-   |                     ^^^^^^^^^^^^ help: replace this with: `(z) as i8`
+   |                     ^^^^^^^^^^^^ help: replace this with: `i8::from(z)`
+
+error: unnecessary transmute
+  --> $DIR/unnecessary-transmutation.rs:30:22
+   |
+LL |     const { unsafe { transmute::<_, u8>(true) } };
+   |                      ^^^^^^^^^^^^^^^^^^^^^^^^ help: replace this with: `(true) as u8`
 
-error: aborting due to 35 previous errors
+error: aborting due to 40 previous errors
 
diff --git a/tests/ui/typeck/closure-ty-mismatch-issue-128561.rs b/tests/ui/typeck/closure-ty-mismatch-issue-128561.rs
new file mode 100644
index 00000000000..589a90e71d6
--- /dev/null
+++ b/tests/ui/typeck/closure-ty-mismatch-issue-128561.rs
@@ -0,0 +1,10 @@
+fn main() {
+    b"abc".iter().for_each(|x| x); //~ ERROR: mismatched types
+
+    b"abc".iter().for_each(|x| dbg!(x)); //~ ERROR: mismatched types
+
+    b"abc".iter().for_each(|x| {
+        println!("{}", x);
+        x //~ ERROR: mismatched types
+    })
+}
diff --git a/tests/ui/typeck/closure-ty-mismatch-issue-128561.stderr b/tests/ui/typeck/closure-ty-mismatch-issue-128561.stderr
new file mode 100644
index 00000000000..31acc5bb10e
--- /dev/null
+++ b/tests/ui/typeck/closure-ty-mismatch-issue-128561.stderr
@@ -0,0 +1,28 @@
+error[E0308]: mismatched types
+  --> $DIR/closure-ty-mismatch-issue-128561.rs:2:32
+   |
+LL |     b"abc".iter().for_each(|x| x);
+   |                                ^ expected `()`, found `&u8`
+   |
+help: consider ignoring the value
+   |
+LL |     b"abc".iter().for_each(|x| _ = x);
+   |                                +++
+
+error[E0308]: mismatched types
+  --> $DIR/closure-ty-mismatch-issue-128561.rs:4:32
+   |
+LL |     b"abc".iter().for_each(|x| dbg!(x));
+   |                                ^^^^^^^ expected `()`, found `&u8`
+   |
+   = note: this error originates in the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error[E0308]: mismatched types
+  --> $DIR/closure-ty-mismatch-issue-128561.rs:8:9
+   |
+LL |         x
+   |         ^ expected `()`, found `&u8`
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0308`.
diff --git a/tests/ui/typeck/ice-unexpected-region-123863.stderr b/tests/ui/typeck/ice-unexpected-region-123863.stderr
index 8a4d767c143..e5050b4d316 100644
--- a/tests/ui/typeck/ice-unexpected-region-123863.stderr
+++ b/tests/ui/typeck/ice-unexpected-region-123863.stderr
@@ -39,7 +39,7 @@ LL |     Inner::concat_strs::<"a">::A
 help: if there were a trait named `Example` with associated type `concat_strs` implemented for `Inner<_>`, you could use the fully-qualified path
    |
 LL -     Inner::concat_strs::<"a">::A
-LL +     <Inner<_> as Example>::concat_strs::A
+LL +     <Inner<_> as Example>::concat_strs::<"a">::A
    |
 
 error: aborting due to 3 previous errors
diff --git a/tests/ui/typeck/issue-107087.stderr b/tests/ui/typeck/issue-107087.stderr
index 289c8d161ae..157ba5a1672 100644
--- a/tests/ui/typeck/issue-107087.stderr
+++ b/tests/ui/typeck/issue-107087.stderr
@@ -2,7 +2,13 @@ error[E0223]: ambiguous associated type
   --> $DIR/issue-107087.rs:16:5
    |
 LL |     A::B::<>::C
-   |     ^^^^^^^^ help: use fully-qualified syntax: `<A<_> as Foo>::B`
+   |     ^^^^^^^^
+   |
+help: use fully-qualified syntax
+   |
+LL -     A::B::<>::C
+LL +     <A<_> as Foo>::B::<>::C
+   |
 
 error: aborting due to 1 previous error