diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs
index 81e8bcbf7cd..7b6d65511c1 100644
--- a/compiler/rustc_errors/src/emitter.rs
+++ b/compiler/rustc_errors/src/emitter.rs
@@ -1832,6 +1832,12 @@ impl EmitterWriter {
             }
             let show_code_change = if has_deletion && !is_multiline {
                 DisplaySuggestion::Diff
+            } else if let [part] = &parts[..]
+                && part.snippet.ends_with('\n')
+                && part.snippet.trim() == complete.trim()
+            {
+                // We are adding a line(s) of code before code that was already there.
+                DisplaySuggestion::Add
             } else if (parts.len() != 1 || parts[0].snippet.trim() != complete.trim())
                 && !is_multiline
             {
@@ -1879,7 +1885,9 @@ impl EmitterWriter {
                 row_num += line_end - line_start;
             }
             let mut unhighlighted_lines = Vec::new();
+            let mut last_pos = 0;
             for (line_pos, (line, highlight_parts)) in lines.by_ref().zip(highlights).enumerate() {
+                last_pos = line_pos;
                 debug!(%line_pos, %line, ?highlight_parts);
 
                 // Remember lines that are not highlighted to hide them if needed
@@ -1963,13 +1971,39 @@ impl EmitterWriter {
                     is_multiline,
                 )
             }
+            if let DisplaySuggestion::Add = show_code_change {
+                // The suggestion adds an entire line of code, ending on a newline, so we'll also
+                // print the *following* line, to provide context of what we're advicing people to
+                // do. Otherwise you would only see contextless code that can be confused for
+                // already existing code, despite the colors and UI elements.
+                let file_lines = sm
+                    .span_to_lines(span.primary_span().unwrap().shrink_to_hi())
+                    .expect("span_to_lines failed when emitting suggestion");
+                let line_num = sm.lookup_char_pos(parts[0].span.lo()).line;
+                if let Some(line) = file_lines.file.get_line(line_num - 1) {
+                    let line = normalize_whitespace(&line);
+                    self.draw_code_line(
+                        &mut buffer,
+                        &mut row_num,
+                        &[],
+                        line_num + last_pos + 1,
+                        &line,
+                        DisplaySuggestion::None,
+                        max_line_num_len,
+                        &file_lines,
+                        is_multiline,
+                    )
+                }
+            }
 
             // This offset and the ones below need to be signed to account for replacement code
             // that is shorter than the original code.
             let mut offsets: Vec<(usize, isize)> = Vec::new();
             // Only show an underline in the suggestions if the suggestion is not the
             // entirety of the code being shown and the displayed code is not multiline.
-            if let DisplaySuggestion::Diff | DisplaySuggestion::Underline = show_code_change {
+            if let DisplaySuggestion::Diff | DisplaySuggestion::Underline | DisplaySuggestion::Add =
+                show_code_change
+            {
                 draw_col_separator_no_space(&mut buffer, row_num, max_line_num_len + 1);
                 for part in parts {
                     let span_start_pos = sm.lookup_char_pos(part.span.lo()).col_display;
@@ -2247,6 +2281,10 @@ impl EmitterWriter {
                 }
             }
             buffer.append(*row_num, &normalize_whitespace(line_to_add), Style::NoStyle);
+        } else if let DisplaySuggestion::Add = show_code_change {
+            buffer.puts(*row_num, 0, &self.maybe_anonymized(line_num), Style::LineNumber);
+            buffer.puts(*row_num, max_line_num_len + 1, "+ ", Style::Addition);
+            buffer.append(*row_num, &normalize_whitespace(line_to_add), Style::NoStyle);
         } else {
             buffer.puts(*row_num, 0, &self.maybe_anonymized(line_num), Style::LineNumber);
             draw_col_separator(buffer, *row_num, max_line_num_len + 1);
@@ -2281,6 +2319,7 @@ enum DisplaySuggestion {
     Underline,
     Diff,
     None,
+    Add,
 }
 
 impl FileWithAnnotatedLines {
diff --git a/src/tools/clippy/tests/ui/crashes/ice-6252.stderr b/src/tools/clippy/tests/ui/crashes/ice-6252.stderr
index efdd56dd47d..3c7e08ebeae 100644
--- a/src/tools/clippy/tests/ui/crashes/ice-6252.stderr
+++ b/src/tools/clippy/tests/ui/crashes/ice-6252.stderr
@@ -6,11 +6,14 @@ LL |     _n: PhantomData,
    |
 help: consider importing one of these items
    |
-LL | use core::marker::PhantomData;
+LL + use core::marker::PhantomData;
+LL | trait TypeVal<T> {
    |
-LL | use serde::__private::PhantomData;
+LL + use serde::__private::PhantomData;
+LL | trait TypeVal<T> {
    |
-LL | use std::marker::PhantomData;
+LL + use std::marker::PhantomData;
+LL | trait TypeVal<T> {
    |
 
 error[E0412]: cannot find type `VAL` in this scope
diff --git a/src/tools/clippy/tests/ui/derivable_impls.stderr b/src/tools/clippy/tests/ui/derivable_impls.stderr
index 81963c3be5b..8089f5ea0fc 100644
--- a/src/tools/clippy/tests/ui/derivable_impls.stderr
+++ b/src/tools/clippy/tests/ui/derivable_impls.stderr
@@ -14,7 +14,8 @@ LL | | }
    = help: remove the manual implementation...
 help: ...and instead derive it
    |
-LL | #[derive(Default)]
+LL + #[derive(Default)]
+LL | struct FooDefault<'a> {
    |
 
 error: this `impl` can be derived
@@ -30,7 +31,8 @@ LL | | }
    = help: remove the manual implementation...
 help: ...and instead derive it
    |
-LL | #[derive(Default)]
+LL + #[derive(Default)]
+LL | struct TupleDefault(bool, i32, u64);
    |
 
 error: this `impl` can be derived
@@ -46,7 +48,8 @@ LL | | }
    = help: remove the manual implementation...
 help: ...and instead derive it
    |
-LL | #[derive(Default)]
+LL + #[derive(Default)]
+LL | struct StrDefault<'a>(&'a str);
    |
 
 error: this `impl` can be derived
@@ -62,7 +65,8 @@ LL | | }
    = help: remove the manual implementation...
 help: ...and instead derive it
    |
-LL | #[derive(Default)]
+LL + #[derive(Default)]
+LL | struct Y(u32);
    |
 
 error: this `impl` can be derived
@@ -78,7 +82,8 @@ LL | | }
    = help: remove the manual implementation...
 help: ...and instead derive it
    |
-LL | #[derive(Default)]
+LL + #[derive(Default)]
+LL | struct WithoutSelfCurly {
    |
 
 error: this `impl` can be derived
@@ -94,7 +99,8 @@ LL | | }
    = help: remove the manual implementation...
 help: ...and instead derive it
    |
-LL | #[derive(Default)]
+LL + #[derive(Default)]
+LL | struct WithoutSelfParan(bool);
    |
 
 error: this `impl` can be derived
@@ -110,7 +116,8 @@ LL | | }
    = help: remove the manual implementation...
 help: ...and instead derive it
    |
-LL | #[derive(Default)]
+LL + #[derive(Default)]
+LL | pub struct RepeatDefault1 {
    |
 
 error: this `impl` can be derived
@@ -126,7 +133,8 @@ LL | | }
    = help: remove the manual implementation...
 help: ...and instead derive it...
    |
-LL | #[derive(Default)]
+LL + #[derive(Default)]
+LL | pub enum SimpleEnum {
    |
 help: ...and mark the default variant
    |
diff --git a/src/tools/clippy/tests/ui/new_without_default.stderr b/src/tools/clippy/tests/ui/new_without_default.stderr
index 583dd327d6a..9b0a2f6ca5b 100644
--- a/src/tools/clippy/tests/ui/new_without_default.stderr
+++ b/src/tools/clippy/tests/ui/new_without_default.stderr
@@ -14,6 +14,7 @@ LL +     fn default() -> Self {
 LL +         Self::new()
 LL +     }
 LL + }
+LL | impl Foo {
    |
 
 error: you should consider adding a `Default` implementation for `Bar`
@@ -31,6 +32,7 @@ LL +     fn default() -> Self {
 LL +         Self::new()
 LL +     }
 LL + }
+LL | impl Bar {
    |
 
 error: you should consider adding a `Default` implementation for `LtKo<'c>`
@@ -48,6 +50,7 @@ LL +     fn default() -> Self {
 LL +         Self::new()
 LL +     }
 LL + }
+LL | impl<'c> LtKo<'c> {
    |
 
 error: you should consider adding a `Default` implementation for `NewNotEqualToDerive`
@@ -65,6 +68,7 @@ LL +     fn default() -> Self {
 LL +         Self::new()
 LL +     }
 LL + }
+LL | impl NewNotEqualToDerive {
    |
 
 error: you should consider adding a `Default` implementation for `FooGenerics<T>`
@@ -82,6 +86,7 @@ LL +     fn default() -> Self {
 LL +         Self::new()
 LL +     }
 LL + }
+LL | impl<T> FooGenerics<T> {
    |
 
 error: you should consider adding a `Default` implementation for `BarGenerics<T>`
@@ -99,6 +104,7 @@ LL +     fn default() -> Self {
 LL +         Self::new()
 LL +     }
 LL + }
+LL | impl<T: Copy> BarGenerics<T> {
    |
 
 error: you should consider adding a `Default` implementation for `Foo<T>`
diff --git a/tests/ui/array-slice-vec/repeat_empty_ok.stderr b/tests/ui/array-slice-vec/repeat_empty_ok.stderr
index 724bdcd920a..e8bac04ac45 100644
--- a/tests/ui/array-slice-vec/repeat_empty_ok.stderr
+++ b/tests/ui/array-slice-vec/repeat_empty_ok.stderr
@@ -7,7 +7,8 @@ LL |     let headers = [Header{value: &[]}; 128];
    = note: the `Copy` trait is required because this value will be copied for each element of the array
 help: consider annotating `Header<'_>` with `#[derive(Copy)]`
    |
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | pub struct Header<'a> {
    |
 
 error[E0277]: the trait bound `Header<'_>: Copy` is not satisfied
@@ -19,7 +20,8 @@ LL |     let headers = [Header{value: &[0]}; 128];
    = note: the `Copy` trait is required because this value will be copied for each element of the array
 help: consider annotating `Header<'_>` with `#[derive(Copy)]`
    |
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | pub struct Header<'a> {
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/associated-types/defaults-suitability.stderr b/tests/ui/associated-types/defaults-suitability.stderr
index 2485758757b..4b2094691f8 100644
--- a/tests/ui/associated-types/defaults-suitability.stderr
+++ b/tests/ui/associated-types/defaults-suitability.stderr
@@ -11,7 +11,8 @@ LL |     type Ty: Clone = NotClone;
    |              ^^^^^ required by this bound in `Tr::Ty`
 help: consider annotating `NotClone` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct NotClone;
    |
 
 error[E0277]: the trait bound `NotClone: Clone` is not satisfied
@@ -30,7 +31,8 @@ LL |     type Ty = NotClone;
    |          -- required by a bound in this associated type
 help: consider annotating `NotClone` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct NotClone;
    |
 
 error[E0277]: the trait bound `T: Clone` is not satisfied
diff --git a/tests/ui/binop/issue-28837.stderr b/tests/ui/binop/issue-28837.stderr
index cca1da3b6ac..bb9f3b8af0f 100644
--- a/tests/ui/binop/issue-28837.stderr
+++ b/tests/ui/binop/issue-28837.stderr
@@ -157,7 +157,8 @@ LL | struct A;
    | ^^^^^^^^ must implement `PartialEq<_>`
 help: consider annotating `A` with `#[derive(PartialEq)]`
    |
-LL | #[derive(PartialEq)]
+LL + #[derive(PartialEq)]
+LL | struct A;
    |
 
 error[E0369]: binary operation `!=` cannot be applied to type `A`
@@ -175,7 +176,8 @@ LL | struct A;
    | ^^^^^^^^ must implement `PartialEq<_>`
 help: consider annotating `A` with `#[derive(PartialEq)]`
    |
-LL | #[derive(PartialEq)]
+LL + #[derive(PartialEq)]
+LL | struct A;
    |
 
 error[E0369]: binary operation `<` cannot be applied to type `A`
@@ -193,7 +195,8 @@ LL | struct A;
    | ^^^^^^^^ must implement `PartialOrd<_>`
 help: consider annotating `A` with `#[derive(PartialEq, PartialOrd)]`
    |
-LL | #[derive(PartialEq, PartialOrd)]
+LL + #[derive(PartialEq, PartialOrd)]
+LL | struct A;
    |
 
 error[E0369]: binary operation `<=` cannot be applied to type `A`
@@ -211,7 +214,8 @@ LL | struct A;
    | ^^^^^^^^ must implement `PartialOrd<_>`
 help: consider annotating `A` with `#[derive(PartialEq, PartialOrd)]`
    |
-LL | #[derive(PartialEq, PartialOrd)]
+LL + #[derive(PartialEq, PartialOrd)]
+LL | struct A;
    |
 
 error[E0369]: binary operation `>` cannot be applied to type `A`
@@ -229,7 +233,8 @@ LL | struct A;
    | ^^^^^^^^ must implement `PartialOrd<_>`
 help: consider annotating `A` with `#[derive(PartialEq, PartialOrd)]`
    |
-LL | #[derive(PartialEq, PartialOrd)]
+LL + #[derive(PartialEq, PartialOrd)]
+LL | struct A;
    |
 
 error[E0369]: binary operation `>=` cannot be applied to type `A`
@@ -247,7 +252,8 @@ LL | struct A;
    | ^^^^^^^^ must implement `PartialOrd<_>`
 help: consider annotating `A` with `#[derive(PartialEq, PartialOrd)]`
    |
-LL | #[derive(PartialEq, PartialOrd)]
+LL + #[derive(PartialEq, PartialOrd)]
+LL | struct A;
    |
 
 error: aborting due to 15 previous errors
diff --git a/tests/ui/box/unit/unique-pinned-nocopy.stderr b/tests/ui/box/unit/unique-pinned-nocopy.stderr
index de6611324ca..2fd5b0d82e8 100644
--- a/tests/ui/box/unit/unique-pinned-nocopy.stderr
+++ b/tests/ui/box/unit/unique-pinned-nocopy.stderr
@@ -19,7 +19,8 @@ LL |       let _j = i.clone();
            candidate #1: `Clone`
 help: consider annotating `R` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct R {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/coherence/coherence_inherent.stderr b/tests/ui/coherence/coherence_inherent.stderr
index 46b128c08fe..48f70700046 100644
--- a/tests/ui/coherence/coherence_inherent.stderr
+++ b/tests/ui/coherence/coherence_inherent.stderr
@@ -7,7 +7,8 @@ LL |         s.the_fn();
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL |     use Lib::TheTrait;
+LL +     use Lib::TheTrait;
+LL |     use Lib::TheStruct;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/coherence/coherence_inherent_cc.stderr b/tests/ui/coherence/coherence_inherent_cc.stderr
index af0ef3b6932..58254740f82 100644
--- a/tests/ui/coherence/coherence_inherent_cc.stderr
+++ b/tests/ui/coherence/coherence_inherent_cc.stderr
@@ -7,7 +7,8 @@ LL |         s.the_fn();
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL |     use coherence_inherent_cc_lib::TheTrait;
+LL +     use coherence_inherent_cc_lib::TheTrait;
+LL |     use coherence_inherent_cc_lib::TheStruct;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/const-generics/generic_const_exprs/issue-94287.stderr b/tests/ui/const-generics/generic_const_exprs/issue-94287.stderr
index 7390a007742..1e4e4edb596 100644
--- a/tests/ui/const-generics/generic_const_exprs/issue-94287.stderr
+++ b/tests/ui/const-generics/generic_const_exprs/issue-94287.stderr
@@ -8,6 +8,7 @@ LL |     If<{ FRAC <= 32 }>: True,
 help: consider enabling this feature
   --> $DIR/issue-94287.rs:1:1
    |
+LL + #![feature(generic_const_exprs)]
 LL | #![feature(generic_const_exprs)]
    |
 
diff --git a/tests/ui/const-generics/issues/issue-82956.stderr b/tests/ui/const-generics/issues/issue-82956.stderr
index d2320293e85..d1d50732551 100644
--- a/tests/ui/const-generics/issues/issue-82956.stderr
+++ b/tests/ui/const-generics/issues/issue-82956.stderr
@@ -6,13 +6,17 @@ LL |         let mut iter = IntoIter::new(self);
    |
 help: consider importing one of these items
    |
-LL | use std::array::IntoIter;
+LL + use std::array::IntoIter;
+LL | pub struct ConstCheck<const CHECK: bool>;
    |
-LL | use std::collections::binary_heap::IntoIter;
+LL + use std::collections::binary_heap::IntoIter;
+LL | pub struct ConstCheck<const CHECK: bool>;
    |
-LL | use std::collections::btree_map::IntoIter;
+LL + use std::collections::btree_map::IntoIter;
+LL | pub struct ConstCheck<const CHECK: bool>;
    |
-LL | use std::collections::btree_set::IntoIter;
+LL + use std::collections::btree_set::IntoIter;
+LL | pub struct ConstCheck<const CHECK: bool>;
    |
      and 8 other candidates
 
diff --git a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
index ee352700c30..174103eeba4 100644
--- a/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
+++ b/tests/ui/consts/const-blocks/fn-call-in-non-const.stderr
@@ -10,7 +10,8 @@ LL |     let _: [Option<Bar>; 2] = [no_copy(); 2];
    = help: create an inline `const` block, see RFC #2920 <https://github.com/rust-lang/rfcs/pull/2920> for more information
 help: consider annotating `Bar` with `#[derive(Copy)]`
    |
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct Bar;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/consts/const-blocks/migrate-fail.stderr b/tests/ui/consts/const-blocks/migrate-fail.stderr
index 928ffd0839d..d1896f755d5 100644
--- a/tests/ui/consts/const-blocks/migrate-fail.stderr
+++ b/tests/ui/consts/const-blocks/migrate-fail.stderr
@@ -8,7 +8,8 @@ LL |         let arr: [Option<Bar>; 2] = [x; 2];
    = note: the `Copy` trait is required because this value will be copied for each element of the array
 help: consider annotating `Bar` with `#[derive(Copy)]`
    |
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct Bar;
    |
 
 error[E0277]: the trait bound `Bar: Copy` is not satisfied
@@ -21,7 +22,8 @@ LL |         let arr: [Option<Bar>; 2] = [x; 2];
    = note: the `Copy` trait is required because this value will be copied for each element of the array
 help: consider annotating `Bar` with `#[derive(Copy)]`
    |
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct Bar;
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/const-blocks/nll-fail.stderr b/tests/ui/consts/const-blocks/nll-fail.stderr
index fede0084547..807c964a51d 100644
--- a/tests/ui/consts/const-blocks/nll-fail.stderr
+++ b/tests/ui/consts/const-blocks/nll-fail.stderr
@@ -8,7 +8,8 @@ LL |         let arr: [Option<Bar>; 2] = [x; 2];
    = note: the `Copy` trait is required because this value will be copied for each element of the array
 help: consider annotating `Bar` with `#[derive(Copy)]`
    |
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct Bar;
    |
 
 error[E0277]: the trait bound `Bar: Copy` is not satisfied
@@ -21,7 +22,8 @@ LL |         let arr: [Option<Bar>; 2] = [x; 2];
    = note: the `Copy` trait is required because this value will be copied for each element of the array
 help: consider annotating `Bar` with `#[derive(Copy)]`
    |
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct Bar;
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
index 778b0e55f66..7ec2508ca93 100644
--- a/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
+++ b/tests/ui/consts/min_const_fn/min_const_fn_libstd_stability.stderr
@@ -22,11 +22,13 @@ LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 }
    |
 help: if it is not part of the public API, make this function unstably const
    |
-LL | #[rustc_const_unstable(feature = "...", issue = "...")]
+LL + #[rustc_const_unstable(feature = "...", issue = "...")]
+LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 }
    |
 help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks
    |
-LL | #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)]
+LL + #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)]
+LL | const fn bar3() -> u32 { (5f32 + 6f32) as u32 }
    |
 
 error: `foo2_gated` is not yet stable as a const fn
diff --git a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr
index 0174cb77f33..72c1f175d1d 100644
--- a/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr
+++ b/tests/ui/consts/min_const_fn/min_const_unsafe_fn_libstd_stability.stderr
@@ -22,11 +22,13 @@ LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 }
    |
 help: if it is not part of the public API, make this function unstably const
    |
-LL | #[rustc_const_unstable(feature = "...", issue = "...")]
+LL + #[rustc_const_unstable(feature = "...", issue = "...")]
+LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 }
    |
 help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks
    |
-LL | #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)]
+LL + #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)]
+LL | const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 }
    |
 
 error: `foo2_gated` is not yet stable as a const fn
diff --git a/tests/ui/derived-errors/issue-31997-1.stderr b/tests/ui/derived-errors/issue-31997-1.stderr
index 2f4aabf8453..2ea3d910dbf 100644
--- a/tests/ui/derived-errors/issue-31997-1.stderr
+++ b/tests/ui/derived-errors/issue-31997-1.stderr
@@ -6,7 +6,8 @@ LL |     let mut map = HashMap::new();
    |
 help: consider importing this struct
    |
-LL | use std::collections::HashMap;
+LL + use std::collections::HashMap;
+LL | use std::io::prelude::*;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derive-assoc-type-not-impl.stderr b/tests/ui/derives/derive-assoc-type-not-impl.stderr
index 91b334b412b..9f17c76c2ec 100644
--- a/tests/ui/derives/derive-assoc-type-not-impl.stderr
+++ b/tests/ui/derives/derive-assoc-type-not-impl.stderr
@@ -23,7 +23,8 @@ LL | #[derive(Clone)]
            candidate #1: `Clone`
 help: consider annotating `NotClone` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct NotClone;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Clone-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Clone-enum-struct-variant.stderr
index 7326324b03c..31ab589cf38 100644
--- a/tests/ui/derives/derives-span-Clone-enum-struct-variant.stderr
+++ b/tests/ui/derives/derives-span-Clone-enum-struct-variant.stderr
@@ -10,7 +10,8 @@ LL |      x: Error
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Clone-enum.stderr b/tests/ui/derives/derives-span-Clone-enum.stderr
index 229a4f7d9ff..b5580c02f38 100644
--- a/tests/ui/derives/derives-span-Clone-enum.stderr
+++ b/tests/ui/derives/derives-span-Clone-enum.stderr
@@ -10,7 +10,8 @@ LL |      Error
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Clone-struct.stderr b/tests/ui/derives/derives-span-Clone-struct.stderr
index 96bad9edad9..fbe7e3f8479 100644
--- a/tests/ui/derives/derives-span-Clone-struct.stderr
+++ b/tests/ui/derives/derives-span-Clone-struct.stderr
@@ -10,7 +10,8 @@ LL |     x: Error
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Clone-tuple-struct.stderr b/tests/ui/derives/derives-span-Clone-tuple-struct.stderr
index b61341e57e6..639f4d54254 100644
--- a/tests/ui/derives/derives-span-Clone-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-Clone-tuple-struct.stderr
@@ -10,7 +10,8 @@ LL |     Error
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr
index 58a64a4f53b..7ff6851f655 100644
--- a/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr
+++ b/tests/ui/derives/derives-span-Debug-enum-struct-variant.stderr
@@ -12,7 +12,8 @@ LL |      x: Error
    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Debug)]`
    |
-LL | #[derive(Debug)]
+LL + #[derive(Debug)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Debug-enum.stderr b/tests/ui/derives/derives-span-Debug-enum.stderr
index e9bb5f960b0..346cbec90a9 100644
--- a/tests/ui/derives/derives-span-Debug-enum.stderr
+++ b/tests/ui/derives/derives-span-Debug-enum.stderr
@@ -12,7 +12,8 @@ LL |      Error
    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Debug)]`
    |
-LL | #[derive(Debug)]
+LL + #[derive(Debug)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Debug-struct.stderr b/tests/ui/derives/derives-span-Debug-struct.stderr
index 0a117c060ff..4b39eeb09ee 100644
--- a/tests/ui/derives/derives-span-Debug-struct.stderr
+++ b/tests/ui/derives/derives-span-Debug-struct.stderr
@@ -12,7 +12,8 @@ LL |     x: Error
    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Debug)]`
    |
-LL | #[derive(Debug)]
+LL + #[derive(Debug)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Debug-tuple-struct.stderr b/tests/ui/derives/derives-span-Debug-tuple-struct.stderr
index f2e90a41845..f3043abcadd 100644
--- a/tests/ui/derives/derives-span-Debug-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-Debug-tuple-struct.stderr
@@ -12,7 +12,8 @@ LL |     Error
    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Debug)]`
    |
-LL | #[derive(Debug)]
+LL + #[derive(Debug)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Default-struct.stderr b/tests/ui/derives/derives-span-Default-struct.stderr
index d4affd535ee..4844b635924 100644
--- a/tests/ui/derives/derives-span-Default-struct.stderr
+++ b/tests/ui/derives/derives-span-Default-struct.stderr
@@ -10,7 +10,8 @@ LL |     x: Error
    = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Default)]`
    |
-LL | #[derive(Default)]
+LL + #[derive(Default)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Default-tuple-struct.stderr b/tests/ui/derives/derives-span-Default-tuple-struct.stderr
index 129351f5998..9cac7f10780 100644
--- a/tests/ui/derives/derives-span-Default-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-Default-tuple-struct.stderr
@@ -10,7 +10,8 @@ LL |     Error
    = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Default)]`
    |
-LL | #[derive(Default)]
+LL + #[derive(Default)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Eq-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Eq-enum-struct-variant.stderr
index 2be69a30b1c..1a9ff983255 100644
--- a/tests/ui/derives/derives-span-Eq-enum-struct-variant.stderr
+++ b/tests/ui/derives/derives-span-Eq-enum-struct-variant.stderr
@@ -12,7 +12,8 @@ note: required by a bound in `AssertParamIsEq`
    = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Eq)]`
    |
-LL | #[derive(Eq)]
+LL + #[derive(Eq)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Eq-enum.stderr b/tests/ui/derives/derives-span-Eq-enum.stderr
index 4f4f821cca3..8205657bb71 100644
--- a/tests/ui/derives/derives-span-Eq-enum.stderr
+++ b/tests/ui/derives/derives-span-Eq-enum.stderr
@@ -12,7 +12,8 @@ note: required by a bound in `AssertParamIsEq`
    = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Eq)]`
    |
-LL | #[derive(Eq)]
+LL + #[derive(Eq)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Eq-struct.stderr b/tests/ui/derives/derives-span-Eq-struct.stderr
index f15659c3e16..af510181df7 100644
--- a/tests/ui/derives/derives-span-Eq-struct.stderr
+++ b/tests/ui/derives/derives-span-Eq-struct.stderr
@@ -12,7 +12,8 @@ note: required by a bound in `AssertParamIsEq`
    = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Eq)]`
    |
-LL | #[derive(Eq)]
+LL + #[derive(Eq)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Eq-tuple-struct.stderr b/tests/ui/derives/derives-span-Eq-tuple-struct.stderr
index 4e5659b35f4..f7c371d7d05 100644
--- a/tests/ui/derives/derives-span-Eq-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-Eq-tuple-struct.stderr
@@ -12,7 +12,8 @@ note: required by a bound in `AssertParamIsEq`
    = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Eq)]`
    |
-LL | #[derive(Eq)]
+LL + #[derive(Eq)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Hash-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Hash-enum-struct-variant.stderr
index fe5e0e96ac7..311edade0f3 100644
--- a/tests/ui/derives/derives-span-Hash-enum-struct-variant.stderr
+++ b/tests/ui/derives/derives-span-Hash-enum-struct-variant.stderr
@@ -10,7 +10,8 @@ LL |      x: Error
    = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Hash)]`
    |
-LL | #[derive(Hash)]
+LL + #[derive(Hash)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Hash-enum.stderr b/tests/ui/derives/derives-span-Hash-enum.stderr
index 99785b87ca8..043aa954bfa 100644
--- a/tests/ui/derives/derives-span-Hash-enum.stderr
+++ b/tests/ui/derives/derives-span-Hash-enum.stderr
@@ -10,7 +10,8 @@ LL |      Error
    = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Hash)]`
    |
-LL | #[derive(Hash)]
+LL + #[derive(Hash)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Hash-struct.stderr b/tests/ui/derives/derives-span-Hash-struct.stderr
index 4db83dd1300..26d31b6613f 100644
--- a/tests/ui/derives/derives-span-Hash-struct.stderr
+++ b/tests/ui/derives/derives-span-Hash-struct.stderr
@@ -10,7 +10,8 @@ LL |     x: Error
    = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Hash)]`
    |
-LL | #[derive(Hash)]
+LL + #[derive(Hash)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Hash-tuple-struct.stderr b/tests/ui/derives/derives-span-Hash-tuple-struct.stderr
index 8660c97e69e..3155a023ce8 100644
--- a/tests/ui/derives/derives-span-Hash-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-Hash-tuple-struct.stderr
@@ -10,7 +10,8 @@ LL |     Error
    = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Hash)]`
    |
-LL | #[derive(Hash)]
+LL + #[derive(Hash)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Ord-enum-struct-variant.stderr b/tests/ui/derives/derives-span-Ord-enum-struct-variant.stderr
index 6e48332c250..1a06aee5235 100644
--- a/tests/ui/derives/derives-span-Ord-enum-struct-variant.stderr
+++ b/tests/ui/derives/derives-span-Ord-enum-struct-variant.stderr
@@ -10,7 +10,8 @@ LL |      x: Error
    = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Ord)]`
    |
-LL | #[derive(Ord)]
+LL + #[derive(Ord)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Ord-enum.stderr b/tests/ui/derives/derives-span-Ord-enum.stderr
index b05cf0a057b..377728e8a7f 100644
--- a/tests/ui/derives/derives-span-Ord-enum.stderr
+++ b/tests/ui/derives/derives-span-Ord-enum.stderr
@@ -10,7 +10,8 @@ LL |      Error
    = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Ord)]`
    |
-LL | #[derive(Ord)]
+LL + #[derive(Ord)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Ord-struct.stderr b/tests/ui/derives/derives-span-Ord-struct.stderr
index c4def34a83d..e00e990da2a 100644
--- a/tests/ui/derives/derives-span-Ord-struct.stderr
+++ b/tests/ui/derives/derives-span-Ord-struct.stderr
@@ -10,7 +10,8 @@ LL |     x: Error
    = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Ord)]`
    |
-LL | #[derive(Ord)]
+LL + #[derive(Ord)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-Ord-tuple-struct.stderr b/tests/ui/derives/derives-span-Ord-tuple-struct.stderr
index a3b288d0fb9..959d0b96404 100644
--- a/tests/ui/derives/derives-span-Ord-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-Ord-tuple-struct.stderr
@@ -10,7 +10,8 @@ LL |     Error
    = note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(Ord)]`
    |
-LL | #[derive(Ord)]
+LL + #[derive(Ord)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr b/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr
index 9953154fd4b..9fc25f2ade4 100644
--- a/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr
+++ b/tests/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr
@@ -15,7 +15,8 @@ LL | struct Error;
    = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialEq)]`
    |
-LL | #[derive(PartialEq)]
+LL + #[derive(PartialEq)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-PartialEq-enum.stderr b/tests/ui/derives/derives-span-PartialEq-enum.stderr
index 7c130452301..f56e784478d 100644
--- a/tests/ui/derives/derives-span-PartialEq-enum.stderr
+++ b/tests/ui/derives/derives-span-PartialEq-enum.stderr
@@ -15,7 +15,8 @@ LL | struct Error;
    = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialEq)]`
    |
-LL | #[derive(PartialEq)]
+LL + #[derive(PartialEq)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-PartialEq-struct.stderr b/tests/ui/derives/derives-span-PartialEq-struct.stderr
index ba3d6ced3f4..76c0b0104af 100644
--- a/tests/ui/derives/derives-span-PartialEq-struct.stderr
+++ b/tests/ui/derives/derives-span-PartialEq-struct.stderr
@@ -15,7 +15,8 @@ LL | struct Error;
    = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialEq)]`
    |
-LL | #[derive(PartialEq)]
+LL + #[derive(PartialEq)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-PartialEq-tuple-struct.stderr b/tests/ui/derives/derives-span-PartialEq-tuple-struct.stderr
index ab0b56a9eef..7dae01dbb99 100644
--- a/tests/ui/derives/derives-span-PartialEq-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-PartialEq-tuple-struct.stderr
@@ -15,7 +15,8 @@ LL | struct Error;
    = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialEq)]`
    |
-LL | #[derive(PartialEq)]
+LL + #[derive(PartialEq)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr b/tests/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr
index 2d19aaf68af..746c1d5d21f 100644
--- a/tests/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr
+++ b/tests/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr
@@ -11,7 +11,8 @@ LL |      x: Error
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialOrd)]`
    |
-LL | #[derive(PartialOrd)]
+LL + #[derive(PartialOrd)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-PartialOrd-enum.stderr b/tests/ui/derives/derives-span-PartialOrd-enum.stderr
index dfbb8060ffa..8af1776dac8 100644
--- a/tests/ui/derives/derives-span-PartialOrd-enum.stderr
+++ b/tests/ui/derives/derives-span-PartialOrd-enum.stderr
@@ -11,7 +11,8 @@ LL |      Error
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialOrd)]`
    |
-LL | #[derive(PartialOrd)]
+LL + #[derive(PartialOrd)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-PartialOrd-struct.stderr b/tests/ui/derives/derives-span-PartialOrd-struct.stderr
index ba63d86e8e4..11ea7f9dc31 100644
--- a/tests/ui/derives/derives-span-PartialOrd-struct.stderr
+++ b/tests/ui/derives/derives-span-PartialOrd-struct.stderr
@@ -11,7 +11,8 @@ LL |     x: Error
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialOrd)]`
    |
-LL | #[derive(PartialOrd)]
+LL + #[derive(PartialOrd)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/derives-span-PartialOrd-tuple-struct.stderr b/tests/ui/derives/derives-span-PartialOrd-tuple-struct.stderr
index 7686ed8064e..0a41a3db31e 100644
--- a/tests/ui/derives/derives-span-PartialOrd-tuple-struct.stderr
+++ b/tests/ui/derives/derives-span-PartialOrd-tuple-struct.stderr
@@ -11,7 +11,8 @@ LL |     Error
    = note: this error originates in the derive macro `PartialOrd` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Error` with `#[derive(PartialOrd)]`
    |
-LL | #[derive(PartialOrd)]
+LL + #[derive(PartialOrd)]
+LL | struct Error;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/deriving-no-inner-impl-error-message.stderr b/tests/ui/derives/deriving-no-inner-impl-error-message.stderr
index ef8c44caacf..10af5d36ed9 100644
--- a/tests/ui/derives/deriving-no-inner-impl-error-message.stderr
+++ b/tests/ui/derives/deriving-no-inner-impl-error-message.stderr
@@ -15,7 +15,8 @@ LL | struct NoCloneOrEq;
    = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `NoCloneOrEq` with `#[derive(PartialEq)]`
    |
-LL | #[derive(PartialEq)]
+LL + #[derive(PartialEq)]
+LL | struct NoCloneOrEq;
    |
 
 error[E0277]: the trait bound `NoCloneOrEq: Clone` is not satisfied
@@ -30,7 +31,8 @@ LL |     x: NoCloneOrEq
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `NoCloneOrEq` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct NoCloneOrEq;
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/derives/deriving-with-repr-packed-2.stderr b/tests/ui/derives/deriving-with-repr-packed-2.stderr
index ab3646057a5..afeca9fec2b 100644
--- a/tests/ui/derives/deriving-with-repr-packed-2.stderr
+++ b/tests/ui/derives/deriving-with-repr-packed-2.stderr
@@ -25,7 +25,8 @@ LL | #[derive(Copy, Clone, Default, PartialEq, Eq)]
    |                ^^^^^ unsatisfied trait bound introduced in this `derive` macro
 help: consider annotating `NonCopy` with `#[derive(Clone, Copy)]`
    |
-LL | #[derive(Clone, Copy)]
+LL + #[derive(Clone, Copy)]
+LL | struct NonCopy;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/derives/issue-91492.stderr b/tests/ui/derives/issue-91492.stderr
index cee30ac50a6..fc64828b153 100644
--- a/tests/ui/derives/issue-91492.stderr
+++ b/tests/ui/derives/issue-91492.stderr
@@ -11,7 +11,8 @@ LL |     foo.extend_from_slice(bar);
            `NoDerives: Clone`
 help: consider annotating `NoDerives` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | pub struct NoDerives;
    |
 
 error[E0599]: the method `extend_from_slice` exists for mutable reference `&mut Vec<SomeDerives>`, but its trait bounds were not satisfied
@@ -27,7 +28,8 @@ LL |     foo.extend_from_slice(bar);
            `SomeDerives: Clone`
 help: consider annotating `SomeDerives` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | pub struct SomeDerives;
    |
 
 error[E0599]: the method `use_clone` exists for struct `Object<NoDerives, SomeDerives>`, but its trait bounds were not satisfied
@@ -51,7 +53,8 @@ LL | impl<T: Clone, A: Default> Object<T, A> {
    |         unsatisfied trait bound introduced here
 help: consider annotating `NoDerives` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | pub struct NoDerives;
    |
 
 error: aborting due to 3 previous errors
diff --git a/tests/ui/derives/issue-91550.stderr b/tests/ui/derives/issue-91550.stderr
index af03f0e5e5f..1324b80b5fc 100644
--- a/tests/ui/derives/issue-91550.stderr
+++ b/tests/ui/derives/issue-91550.stderr
@@ -18,7 +18,8 @@ LL |     hs.insert(Value(0));
            `Value: Hash`
 help: consider annotating `Value` with `#[derive(Eq, Hash, PartialEq)]`
    |
-LL | #[derive(Eq, Hash, PartialEq)]
+LL + #[derive(Eq, Hash, PartialEq)]
+LL | struct Value(u32);
    |
 
 error[E0599]: the method `use_eq` exists for struct `Object<NoDerives>`, but its trait bounds were not satisfied
@@ -48,7 +49,8 @@ LL | impl<T: Eq> Object<T> {
            which is required by `NoDerives: Eq`
 help: consider annotating `NoDerives` with `#[derive(Eq, PartialEq)]`
    |
-LL | #[derive(Eq, PartialEq)]
+LL + #[derive(Eq, PartialEq)]
+LL | pub struct NoDerives;
    |
 
 error[E0599]: the method `use_ord` exists for struct `Object<NoDerives>`, but its trait bounds were not satisfied
@@ -84,7 +86,8 @@ LL | impl<T: Ord> Object<T> {
            which is required by `NoDerives: Ord`
 help: consider annotating `NoDerives` with `#[derive(Eq, Ord, PartialEq, PartialOrd)]`
    |
-LL | #[derive(Eq, Ord, PartialEq, PartialOrd)]
+LL + #[derive(Eq, Ord, PartialEq, PartialOrd)]
+LL | pub struct NoDerives;
    |
 
 error[E0599]: the method `use_ord_and_partial_ord` exists for struct `Object<NoDerives>`, but its trait bounds were not satisfied
@@ -123,7 +126,8 @@ LL | impl<T: Ord + PartialOrd> Object<T> {
            which is required by `NoDerives: PartialOrd`
 help: consider annotating `NoDerives` with `#[derive(Eq, Ord, PartialEq, PartialOrd)]`
    |
-LL | #[derive(Eq, Ord, PartialEq, PartialOrd)]
+LL + #[derive(Eq, Ord, PartialEq, PartialOrd)]
+LL | pub struct NoDerives;
    |
 
 error: aborting due to 4 previous errors
diff --git a/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr b/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr
index abc040c0546..11cdcfadef3 100644
--- a/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr
+++ b/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr
@@ -24,13 +24,17 @@ LL | fn setup() -> Set { Set }
    |
 help: consider importing one of these items
    |
-LL | use AffixHeart::Set;
+LL + use AffixHeart::Set;
+LL | enum PutDown { Set }
    |
-LL | use CauseToBe::Set;
+LL + use CauseToBe::Set;
+LL | enum PutDown { Set }
    |
-LL | use Determine::Set;
+LL + use Determine::Set;
+LL | enum PutDown { Set }
    |
-LL | use PutDown::Set;
+LL + use PutDown::Set;
+LL | enum PutDown { Set }
    |
      and 3 other candidates
 
diff --git a/tests/ui/error-codes/E0277-3.stderr b/tests/ui/error-codes/E0277-3.stderr
index 0127e1ccc81..0d4782935df 100644
--- a/tests/ui/error-codes/E0277-3.stderr
+++ b/tests/ui/error-codes/E0277-3.stderr
@@ -14,7 +14,8 @@ LL | fn foo<T: PartialEq>(_: T) {}
    |           ^^^^^^^^^ required by this bound in `foo`
 help: consider annotating `S` with `#[derive(PartialEq)]`
    |
-LL | #[derive(PartialEq)]
+LL + #[derive(PartialEq)]
+LL | struct S;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/fmt/format-args-argument-span.stderr b/tests/ui/fmt/format-args-argument-span.stderr
index b060b2cd339..4e2702383d6 100644
--- a/tests/ui/fmt/format-args-argument-span.stderr
+++ b/tests/ui/fmt/format-args-argument-span.stderr
@@ -29,7 +29,8 @@ LL |     println!("{x} {x:?} {x}");
    = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `DisplayOnly` with `#[derive(Debug)]`
    |
-LL | #[derive(Debug)]
+LL + #[derive(Debug)]
+LL | struct DisplayOnly;
    |
 
 error[E0277]: `DisplayOnly` doesn't implement `Debug`
@@ -43,7 +44,8 @@ LL |     println!("{x} {x:?} {x}", x = DisplayOnly);
    = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `DisplayOnly` with `#[derive(Debug)]`
    |
-LL | #[derive(Debug)]
+LL + #[derive(Debug)]
+LL | struct DisplayOnly;
    |
 
 error: aborting due to 4 previous errors
diff --git a/tests/ui/generator/clone-impl.stderr b/tests/ui/generator/clone-impl.stderr
index a92646b198c..64eb47c1a5a 100644
--- a/tests/ui/generator/clone-impl.stderr
+++ b/tests/ui/generator/clone-impl.stderr
@@ -110,7 +110,8 @@ LL | fn check_copy<T: Copy>(_x: &T) {}
    |                  ^^^^ required by this bound in `check_copy`
 help: consider annotating `NonClone` with `#[derive(Copy)]`
    |
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct NonClone;
    |
 
 error[E0277]: the trait bound `NonClone: Clone` is not satisfied in `[generator@$DIR/clone-impl.rs:62:25: 62:32]`
@@ -134,7 +135,8 @@ LL | fn check_clone<T: Clone>(_x: &T) {}
    |                   ^^^^^ required by this bound in `check_clone`
 help: consider annotating `NonClone` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct NonClone;
    |
 
 error: aborting due to 6 previous errors
diff --git a/tests/ui/generic-associated-types/issue-87429-associated-type-default.stderr b/tests/ui/generic-associated-types/issue-87429-associated-type-default.stderr
index b1abe012be2..a44bb6993d4 100644
--- a/tests/ui/generic-associated-types/issue-87429-associated-type-default.stderr
+++ b/tests/ui/generic-associated-types/issue-87429-associated-type-default.stderr
@@ -12,7 +12,8 @@ LL |     type Member<'a>: for<'b> PartialEq<Self::Member<'b>> = Foo;
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Family2::Member`
 help: consider annotating `Foo` with `#[derive(PartialEq)]`
    |
-LL | #[derive(PartialEq)]
+LL + #[derive(PartialEq)]
+LL | struct Foo;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/generic-associated-types/issue-87429-specialization.stderr b/tests/ui/generic-associated-types/issue-87429-specialization.stderr
index 11c4ebf604e..c259c89a712 100644
--- a/tests/ui/generic-associated-types/issue-87429-specialization.stderr
+++ b/tests/ui/generic-associated-types/issue-87429-specialization.stderr
@@ -22,7 +22,8 @@ LL |     type Member<'a>: for<'b> PartialEq<Self::Member<'b>>;
    |                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Family::Member`
 help: consider annotating `Foo` with `#[derive(PartialEq)]`
    |
-LL | #[derive(PartialEq)]
+LL + #[derive(PartialEq)]
+LL | struct Foo;
    |
 
 error: aborting due to previous error; 1 warning emitted
diff --git a/tests/ui/hygiene/globs.stderr b/tests/ui/hygiene/globs.stderr
index c01901be5fe..b68950b66db 100644
--- a/tests/ui/hygiene/globs.stderr
+++ b/tests/ui/hygiene/globs.stderr
@@ -13,7 +13,8 @@ LL |         g();
    |         ~
 help: consider importing this function
    |
-LL | use foo::f;
+LL + use foo::f;
+LL | mod foo {
    |
 
 error[E0425]: cannot find function `g` in this scope
@@ -39,7 +40,8 @@ LL |     f();
    |     ~
 help: consider importing this function
    |
-LL | use bar::g;
+LL + use bar::g;
+LL | mod foo {
    |
 
 error[E0425]: cannot find function `f` in this scope
diff --git a/tests/ui/hygiene/no_implicit_prelude.stderr b/tests/ui/hygiene/no_implicit_prelude.stderr
index c48c840352f..21cecfefd34 100644
--- a/tests/ui/hygiene/no_implicit_prelude.stderr
+++ b/tests/ui/hygiene/no_implicit_prelude.stderr
@@ -10,7 +10,8 @@ LL |         Vec::new();
    = note: this error originates in the macro `::bar::m` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this struct
    |
-LL |     use std::vec::Vec;
+LL +     use std::vec::Vec;
+LL |     pub macro m() { Vec::<i32>::new(); ().clone() }
    |
 
 error[E0599]: no method named `clone` found for unit type `()` in the current scope
@@ -26,7 +27,8 @@ LL |         ().clone()
    = note: this error originates in the macro `::bar::m` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL |     use std::clone::Clone;
+LL +     use std::clone::Clone;
+LL |     pub macro m() { Vec::<i32>::new(); ().clone() }
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/hygiene/trait_items.stderr b/tests/ui/hygiene/trait_items.stderr
index 80bdbe0e21e..60cf6787f82 100644
--- a/tests/ui/hygiene/trait_items.stderr
+++ b/tests/ui/hygiene/trait_items.stderr
@@ -14,7 +14,8 @@ LL |     pub macro m() { ().f() }
    = note: this error originates in the macro `::baz::m` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL |     use foo::T;
+LL +     use foo::T;
+LL |     use foo::*;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/impl-trait/no-method-suggested-traits.stderr b/tests/ui/impl-trait/no-method-suggested-traits.stderr
index 3c2c01dc227..0d37ea38b58 100644
--- a/tests/ui/impl-trait/no-method-suggested-traits.stderr
+++ b/tests/ui/impl-trait/no-method-suggested-traits.stderr
@@ -7,13 +7,17 @@ LL |     1u32.method();
    = help: items from traits can only be used if the trait is in scope
 help: the following traits are implemented but not in scope; perhaps add a `use` for one of them:
    |
-LL | use foo::Bar;
+LL + use foo::Bar;
+LL | extern crate no_method_suggested_traits;
    |
-LL | use no_method_suggested_traits::Reexported;
+LL + use no_method_suggested_traits::Reexported;
+LL | extern crate no_method_suggested_traits;
    |
-LL | use no_method_suggested_traits::foo::PubPub;
+LL + use no_method_suggested_traits::foo::PubPub;
+LL | extern crate no_method_suggested_traits;
    |
-LL | use no_method_suggested_traits::qux::PrivPub;
+LL + use no_method_suggested_traits::qux::PrivPub;
+LL | extern crate no_method_suggested_traits;
    |
 
 error[E0599]: no method named `method` found for struct `Rc<&mut Box<&u32>>` in the current scope
@@ -25,13 +29,17 @@ LL |     std::rc::Rc::new(&mut Box::new(&1u32)).method();
    = help: items from traits can only be used if the trait is in scope
 help: the following traits are implemented but not in scope; perhaps add a `use` for one of them:
    |
-LL | use foo::Bar;
+LL + use foo::Bar;
+LL | extern crate no_method_suggested_traits;
    |
-LL | use no_method_suggested_traits::Reexported;
+LL + use no_method_suggested_traits::Reexported;
+LL | extern crate no_method_suggested_traits;
    |
-LL | use no_method_suggested_traits::foo::PubPub;
+LL + use no_method_suggested_traits::foo::PubPub;
+LL | extern crate no_method_suggested_traits;
    |
-LL | use no_method_suggested_traits::qux::PrivPub;
+LL + use no_method_suggested_traits::qux::PrivPub;
+LL | extern crate no_method_suggested_traits;
    |
 
 error[E0599]: no method named `method` found for type `char` in the current scope
@@ -46,7 +54,8 @@ LL |     'a'.method();
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use foo::Bar;
+LL + use foo::Bar;
+LL | extern crate no_method_suggested_traits;
    |
 
 error[E0599]: no method named `method` found for struct `Rc<&mut Box<&char>>` in the current scope
@@ -58,7 +67,8 @@ LL |     std::rc::Rc::new(&mut Box::new(&'a')).method();
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use foo::Bar;
+LL + use foo::Bar;
+LL | extern crate no_method_suggested_traits;
    |
 
 error[E0599]: no method named `method` found for type `i32` in the current scope
@@ -75,7 +85,8 @@ LL |         fn method(&self) {}
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use no_method_suggested_traits::foo::PubPub;
+LL + use no_method_suggested_traits::foo::PubPub;
+LL | extern crate no_method_suggested_traits;
    |
 
 error[E0599]: no method named `method` found for struct `Rc<&mut Box<&i32>>` in the current scope
@@ -87,7 +98,8 @@ LL |     std::rc::Rc::new(&mut Box::new(&1i32)).method();
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use no_method_suggested_traits::foo::PubPub;
+LL + use no_method_suggested_traits::foo::PubPub;
+LL | extern crate no_method_suggested_traits;
    |
 
 error[E0599]: no method named `method` found for struct `Foo` in the current scope
diff --git a/tests/ui/impl-trait/universal_wrong_bounds.stderr b/tests/ui/impl-trait/universal_wrong_bounds.stderr
index 3b1a5e5f4ad..1561708efba 100644
--- a/tests/ui/impl-trait/universal_wrong_bounds.stderr
+++ b/tests/ui/impl-trait/universal_wrong_bounds.stderr
@@ -6,7 +6,8 @@ LL | fn wants_debug(g: impl Debug) { }
    |
 help: consider importing this trait instead
    |
-LL | use std::fmt::Debug;
+LL + use std::fmt::Debug;
+LL | use std::fmt::Display;
    |
 
 error[E0404]: expected trait, found derive macro `Debug`
@@ -17,7 +18,8 @@ LL | fn wants_display(g: impl Debug) { }
    |
 help: consider importing this trait instead
    |
-LL | use std::fmt::Debug;
+LL + use std::fmt::Debug;
+LL | use std::fmt::Display;
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/imports/glob-resolve1.stderr b/tests/ui/imports/glob-resolve1.stderr
index 3b66a5e3150..6d7ceb25a8f 100644
--- a/tests/ui/imports/glob-resolve1.stderr
+++ b/tests/ui/imports/glob-resolve1.stderr
@@ -60,7 +60,8 @@ LL |     import();
    |
 help: consider importing this function
    |
-LL | use other::import;
+LL + use other::import;
+LL | use bar::*;
    |
 
 error[E0412]: cannot find type `A` in this scope
diff --git a/tests/ui/imports/issue-38293.stderr b/tests/ui/imports/issue-38293.stderr
index d2450ab1250..7a3b405a782 100644
--- a/tests/ui/imports/issue-38293.stderr
+++ b/tests/ui/imports/issue-38293.stderr
@@ -12,7 +12,8 @@ LL |     baz();
    |
 help: consider importing this function instead
    |
-LL | use bar::baz;
+LL + use bar::baz;
+LL | use foo::f::{self};
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/imports/issue-4366-2.stderr b/tests/ui/imports/issue-4366-2.stderr
index 4c94634ee60..d8539f9a9d4 100644
--- a/tests/ui/imports/issue-4366-2.stderr
+++ b/tests/ui/imports/issue-4366-2.stderr
@@ -18,7 +18,8 @@ LL |     foo();
    |
 help: consider importing this function instead
    |
-LL | use foo::foo;
+LL + use foo::foo;
+LL | use m1::*;
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/imports/issue-4366.stderr b/tests/ui/imports/issue-4366.stderr
index 469ea93e904..724db83e99a 100644
--- a/tests/ui/imports/issue-4366.stderr
+++ b/tests/ui/imports/issue-4366.stderr
@@ -6,7 +6,8 @@ LL |         fn sub() -> isize { foo(); 1 }
    |
 help: consider importing this function
    |
-LL |         use foo::foo;
+LL +         use foo::foo;
+LL |         use a::b::*;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/imports/overlapping_pub_trait.stderr b/tests/ui/imports/overlapping_pub_trait.stderr
index d0c845a5e52..268709e11b6 100644
--- a/tests/ui/imports/overlapping_pub_trait.stderr
+++ b/tests/ui/imports/overlapping_pub_trait.stderr
@@ -12,7 +12,8 @@ LL |     pub trait Tr { fn method(&self); }
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use overlapping_pub_trait_source::m::Tr;
+LL + use overlapping_pub_trait_source::m::Tr;
+LL | extern crate overlapping_pub_trait_source;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/imports/unnamed_pub_trait.stderr b/tests/ui/imports/unnamed_pub_trait.stderr
index 319dfd7e1b2..47fa6d3a398 100644
--- a/tests/ui/imports/unnamed_pub_trait.stderr
+++ b/tests/ui/imports/unnamed_pub_trait.stderr
@@ -12,7 +12,8 @@ LL |     pub trait Tr { fn method(&self); }
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use unnamed_pub_trait_source::prelude::*; // trait Tr
+LL + use unnamed_pub_trait_source::prelude::*; // trait Tr
+LL | extern crate unnamed_pub_trait_source;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/internal/internal-unstable-const.stderr b/tests/ui/internal/internal-unstable-const.stderr
index 37d2ea6d2dc..5c63992d819 100644
--- a/tests/ui/internal/internal-unstable-const.stderr
+++ b/tests/ui/internal/internal-unstable-const.stderr
@@ -6,11 +6,13 @@ LL |     1.0 + 1.0
    |
 help: if it is not part of the public API, make this function unstably const
    |
-LL | #[rustc_const_unstable(feature = "...", issue = "...")]
+LL + #[rustc_const_unstable(feature = "...", issue = "...")]
+LL | pub const fn foo() -> f32 {
    |
 help: otherwise `#[rustc_allow_const_fn_unstable]` can be used to bypass stability checks
    |
-LL | #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)]
+LL + #[rustc_allow_const_fn_unstable(const_fn_floating_point_arithmetic)]
+LL | pub const fn foo() -> f32 {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/issues/issue-10465.stderr b/tests/ui/issues/issue-10465.stderr
index 0ccf69dc060..9941e14a94e 100644
--- a/tests/ui/issues/issue-10465.stderr
+++ b/tests/ui/issues/issue-10465.stderr
@@ -7,7 +7,8 @@ LL |             b.foo();
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL |         use a::A;
+LL +         use a::A;
+LL |         use b::B;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/issues/issue-17546.stderr b/tests/ui/issues/issue-17546.stderr
index 81592320a27..23a12fa167b 100644
--- a/tests/ui/issues/issue-17546.stderr
+++ b/tests/ui/issues/issue-17546.stderr
@@ -24,13 +24,17 @@ LL |     fn new() -> Result<foo::MyEnum, String> {
    |
 help: consider importing one of these items instead
    |
-LL |     use std::fmt::Result;
+LL +     use std::fmt::Result;
+LL |     use foo::MyEnum::Result;
    |
-LL |     use std::io::Result;
+LL +     use std::io::Result;
+LL |     use foo::MyEnum::Result;
    |
-LL |     use std::result::Result;
+LL +     use std::result::Result;
+LL |     use foo::MyEnum::Result;
    |
-LL |     use std::thread::Result;
+LL +     use std::thread::Result;
+LL |     use foo::MyEnum::Result;
    |
 
 error[E0573]: expected type, found variant `Result`
@@ -41,13 +45,17 @@ LL | fn new() -> Result<foo::MyEnum, String> {
    |
 help: consider importing one of these items instead
    |
-LL | use std::fmt::Result;
+LL + use std::fmt::Result;
+LL | use foo::MyEnum::Result;
    |
-LL | use std::io::Result;
+LL + use std::io::Result;
+LL | use foo::MyEnum::Result;
    |
-LL | use std::result::Result;
+LL + use std::result::Result;
+LL | use foo::MyEnum::Result;
    |
-LL | use std::thread::Result;
+LL + use std::thread::Result;
+LL | use foo::MyEnum::Result;
    |
 
 error[E0573]: expected type, found variant `NoResult`
diff --git a/tests/ui/issues/issue-20162.stderr b/tests/ui/issues/issue-20162.stderr
index 1c5b76fbfc1..ebdf2528fe1 100644
--- a/tests/ui/issues/issue-20162.stderr
+++ b/tests/ui/issues/issue-20162.stderr
@@ -8,7 +8,8 @@ note: required by a bound in `slice::<impl [T]>::sort`
   --> $SRC_DIR/alloc/src/slice.rs:LL:COL
 help: consider annotating `X` with `#[derive(Ord)]`
    |
-LL | #[derive(Ord)]
+LL + #[derive(Ord)]
+LL | struct X { x: i32 }
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/issues/issue-21160.stderr b/tests/ui/issues/issue-21160.stderr
index 266749376eb..b39a3aad371 100644
--- a/tests/ui/issues/issue-21160.stderr
+++ b/tests/ui/issues/issue-21160.stderr
@@ -9,7 +9,8 @@ LL | struct Foo(Bar);
    = note: this error originates in the derive macro `Hash` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Bar` with `#[derive(Hash)]`
    |
-LL | #[derive(Hash)]
+LL + #[derive(Hash)]
+LL | struct Bar;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/issues/issue-35976.unimported.stderr b/tests/ui/issues/issue-35976.unimported.stderr
index 5d61bb8ea37..8a3e2fcd083 100644
--- a/tests/ui/issues/issue-35976.unimported.stderr
+++ b/tests/ui/issues/issue-35976.unimported.stderr
@@ -9,7 +9,8 @@ LL |     arg.wait();
    |
 help: another candidate was found in the following trait, perhaps add a `use` for it:
    |
-LL | use private::Future;
+LL + use private::Future;
+LL | mod private {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/issues/issue-37534.stderr b/tests/ui/issues/issue-37534.stderr
index 895479986f1..8449eb9c692 100644
--- a/tests/ui/issues/issue-37534.stderr
+++ b/tests/ui/issues/issue-37534.stderr
@@ -6,7 +6,8 @@ LL | struct Foo<T: ?Hash> { }
    |
 help: consider importing this trait instead
    |
-LL | use std::hash::Hash;
+LL + use std::hash::Hash;
+LL | struct Foo<T: ?Hash> { }
    |
 
 warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported
diff --git a/tests/ui/issues/issue-39175.stderr b/tests/ui/issues/issue-39175.stderr
index afceae82e68..19e7f5162a7 100644
--- a/tests/ui/issues/issue-39175.stderr
+++ b/tests/ui/issues/issue-39175.stderr
@@ -7,7 +7,8 @@ LL |     Command::new("echo").arg("hello").exec();
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use std::os::unix::process::CommandExt;
+LL + use std::os::unix::process::CommandExt;
+LL | use std::process::Command;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/issues/issue-56175.stderr b/tests/ui/issues/issue-56175.stderr
index 013a440ed04..bedbaef29b9 100644
--- a/tests/ui/issues/issue-56175.stderr
+++ b/tests/ui/issues/issue-56175.stderr
@@ -12,7 +12,8 @@ LL |         fn trait_method(&self) {
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use reexported_trait::Trait;
+LL + use reexported_trait::Trait;
+LL | fn main() {
    |
 
 error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope
@@ -29,7 +30,8 @@ LL |         fn trait_method_b(&self) {
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use reexported_trait::TraitBRename;
+LL + use reexported_trait::TraitBRename;
+LL | fn main() {
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/issues/issue-62375.stderr b/tests/ui/issues/issue-62375.stderr
index 478e025bed2..a6fd3700edd 100644
--- a/tests/ui/issues/issue-62375.stderr
+++ b/tests/ui/issues/issue-62375.stderr
@@ -13,7 +13,8 @@ LL | enum A {
    | ^^^^^^ must implement `PartialEq<_>`
 help: consider annotating `A` with `#[derive(PartialEq)]`
    |
-LL | #[derive(PartialEq)]
+LL + #[derive(PartialEq)]
+LL | enum A {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/issues/issue-77919.stderr b/tests/ui/issues/issue-77919.stderr
index d154bfe0cb5..1f3f6cb33c7 100644
--- a/tests/ui/issues/issue-77919.stderr
+++ b/tests/ui/issues/issue-77919.stderr
@@ -6,7 +6,8 @@ LL |     _n: PhantomData,
    |
 help: consider importing this struct
    |
-LL | use std::marker::PhantomData;
+LL + use std::marker::PhantomData;
+LL | fn main() {
    |
 
 error[E0412]: cannot find type `VAL` in this scope
diff --git a/tests/ui/kindck/kindck-impl-type-params.stderr b/tests/ui/kindck/kindck-impl-type-params.stderr
index 6fd1fc3f7a1..efb25bf83e1 100644
--- a/tests/ui/kindck/kindck-impl-type-params.stderr
+++ b/tests/ui/kindck/kindck-impl-type-params.stderr
@@ -107,7 +107,8 @@ LL | impl<T: Send + Copy + 'static> Gettable<T> for S<T> {}
    = note: required for the cast from `S<Foo>` to the object type `dyn Gettable<Foo>`
 help: consider annotating `Foo` with `#[derive(Copy)]`
    |
-LL |     #[derive(Copy)]
+LL +     #[derive(Copy)]
+LL |     struct Foo; // does not impl Copy
    |
 
 error: aborting due to 6 previous errors
diff --git a/tests/ui/layout/issue-84108.stderr b/tests/ui/layout/issue-84108.stderr
index 36be6424110..cdc21df79a7 100644
--- a/tests/ui/layout/issue-84108.stderr
+++ b/tests/ui/layout/issue-84108.stderr
@@ -6,7 +6,8 @@ LL | static FOO: (dyn AsRef<OsStr>, u8) = ("hello", 42);
    |
 help: consider importing this struct
    |
-LL | use std::ffi::OsStr;
+LL + use std::ffi::OsStr;
+LL | static FOO: (dyn AsRef<OsStr>, u8) = ("hello", 42);
    |
 
 error[E0412]: cannot find type `Path` in this scope
@@ -17,7 +18,8 @@ LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42);
    |
 help: consider importing this struct
    |
-LL | use std::path::Path;
+LL + use std::path::Path;
+LL | static FOO: (dyn AsRef<OsStr>, u8) = ("hello", 42);
    |
 
 error[E0277]: the size for values of type `[u8]` cannot be known at compilation time
diff --git a/tests/ui/macros/issue-100199.stderr b/tests/ui/macros/issue-100199.stderr
index 2cb45dc1247..ab6bc08b5f7 100644
--- a/tests/ui/macros/issue-100199.stderr
+++ b/tests/ui/macros/issue-100199.stderr
@@ -7,7 +7,8 @@ LL | #[issue_100199::struct_with_bound]
    = note: this error originates in the attribute macro `issue_100199::struct_with_bound` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider importing this trait
    |
-LL | use traits::MyTrait;
+LL + use traits::MyTrait;
+LL | #[issue_100199::struct_with_bound]
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/macros/macro-outer-attributes.stderr b/tests/ui/macros/macro-outer-attributes.stderr
index 4ea760ab82b..cfd1c7739ba 100644
--- a/tests/ui/macros/macro-outer-attributes.stderr
+++ b/tests/ui/macros/macro-outer-attributes.stderr
@@ -6,7 +6,8 @@ LL |     a::bar();
    |
 help: consider importing this function
    |
-LL | use b::bar;
+LL + use b::bar;
+LL | macro_rules! test { ($nm:ident,
    |
 help: if you import `bar`, refer to it directly
    |
diff --git a/tests/ui/malformed/malformed-derive-entry.stderr b/tests/ui/malformed/malformed-derive-entry.stderr
index 6ff6fbabb4a..3059d75d718 100644
--- a/tests/ui/malformed/malformed-derive-entry.stderr
+++ b/tests/ui/malformed/malformed-derive-entry.stderr
@@ -27,7 +27,8 @@ note: required by a bound in `Copy`
    = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Test1` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct Test1;
    |
 
 error[E0277]: the trait bound `Test2: Clone` is not satisfied
@@ -41,7 +42,8 @@ note: required by a bound in `Copy`
    = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Test2` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct Test2;
    |
 
 error: aborting due to 5 previous errors
diff --git a/tests/ui/mismatched_types/method-help-unsatisfied-bound.stderr b/tests/ui/mismatched_types/method-help-unsatisfied-bound.stderr
index d3b7525072f..9dab3e52255 100644
--- a/tests/ui/mismatched_types/method-help-unsatisfied-bound.stderr
+++ b/tests/ui/mismatched_types/method-help-unsatisfied-bound.stderr
@@ -10,7 +10,8 @@ note: required by a bound in `Result::<T, E>::unwrap`
   --> $SRC_DIR/core/src/result.rs:LL:COL
 help: consider annotating `Foo` with `#[derive(Debug)]`
    |
-LL | #[derive(Debug)]
+LL + #[derive(Debug)]
+LL | struct Foo;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/modules/issue-107649.stderr b/tests/ui/modules/issue-107649.stderr
index 1cea71f2829..38a910b57b4 100644
--- a/tests/ui/modules/issue-107649.stderr
+++ b/tests/ui/modules/issue-107649.stderr
@@ -10,7 +10,8 @@ error[E0277]: `Dummy` doesn't implement `Debug`
 help: consider annotating `Dummy` with `#[derive(Debug)]`
    --> $DIR/auxiliary/dummy_lib.rs:2:1
     |
-2   | #[derive(Debug)]
+2   + #[derive(Debug)]
+3   | #[path = "auxiliary/dummy_lib.rs"]
     |
 
 error: aborting due to previous error
diff --git a/tests/ui/namespace/namespace-mix.stderr b/tests/ui/namespace/namespace-mix.stderr
index cb72d4a1c42..216548180bc 100644
--- a/tests/ui/namespace/namespace-mix.stderr
+++ b/tests/ui/namespace/namespace-mix.stderr
@@ -14,9 +14,11 @@ LL |     check(m1::TS);
    |               ~~
 help: consider importing one of these items instead
    |
-LL | use m2::S;
+LL + use m2::S;
+LL | use namespace_mix::*;
    |
-LL | use xm2::S;
+LL + use xm2::S;
+LL | use namespace_mix::*;
    |
 help: if you import `S`, refer to it directly
    |
@@ -42,9 +44,11 @@ LL |     check(xm1::TS);
    |                ~~
 help: consider importing one of these items instead
    |
-LL | use m2::S;
+LL + use m2::S;
+LL | use namespace_mix::*;
    |
-LL | use xm2::S;
+LL + use xm2::S;
+LL | use namespace_mix::*;
    |
 help: if you import `S`, refer to it directly
    |
@@ -68,9 +72,11 @@ LL |     check(m7::TV);
    |               ~~
 help: consider importing one of these items instead
    |
-LL | use m8::V;
+LL + use m8::V;
+LL | use namespace_mix::*;
    |
-LL | use xm8::V;
+LL + use xm8::V;
+LL | use namespace_mix::*;
    |
 help: if you import `V`, refer to it directly
    |
@@ -96,9 +102,11 @@ LL |     check(xm7::TV);
    |                ~~
 help: consider importing one of these items instead
    |
-LL | use m8::V;
+LL + use m8::V;
+LL | use namespace_mix::*;
    |
-LL | use xm8::V;
+LL + use xm8::V;
+LL | use namespace_mix::*;
    |
 help: if you import `V`, refer to it directly
    |
diff --git a/tests/ui/not-clone-closure.stderr b/tests/ui/not-clone-closure.stderr
index 37d94cf0ebd..db9307c6185 100644
--- a/tests/ui/not-clone-closure.stderr
+++ b/tests/ui/not-clone-closure.stderr
@@ -14,7 +14,8 @@ LL |     let hello = move || {
    |                 ^^^^^^^
 help: consider annotating `S` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct S(i32);
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/on-unimplemented/no-debug.stderr b/tests/ui/on-unimplemented/no-debug.stderr
index 1035da54d8a..97d67dbd82e 100644
--- a/tests/ui/on-unimplemented/no-debug.stderr
+++ b/tests/ui/on-unimplemented/no-debug.stderr
@@ -9,7 +9,8 @@ LL |     println!("{:?} {:?}", Foo, Bar);
    = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Foo` with `#[derive(Debug)]`
    |
-LL | #[derive(Debug)]
+LL + #[derive(Debug)]
+LL | struct Foo;
    |
 
 error[E0277]: `Bar` doesn't implement `Debug`
diff --git a/tests/ui/parser/circular_modules_main.stderr b/tests/ui/parser/circular_modules_main.stderr
index 1094def6014..2804c6ebf50 100644
--- a/tests/ui/parser/circular_modules_main.stderr
+++ b/tests/ui/parser/circular_modules_main.stderr
@@ -12,7 +12,8 @@ LL |     println!("{}", circular_modules_main::hi_str());
    |
 help: consider importing this function
    |
-LL | use hi_str;
+LL + use hi_str;
+LL | #[path = "circular_modules_main.rs"]
    |
 help: if you import `hi_str`, refer to it directly
    |
diff --git a/tests/ui/privacy/privacy-ns1.stderr b/tests/ui/privacy/privacy-ns1.stderr
index 91bc84e70ac..fe3e4a78a84 100644
--- a/tests/ui/privacy/privacy-ns1.stderr
+++ b/tests/ui/privacy/privacy-ns1.stderr
@@ -13,7 +13,8 @@ LL |     Baz();
    |     ~~~
 help: consider importing this function instead
    |
-LL | use foo2::Bar;
+LL + use foo2::Bar;
+LL | pub mod foo1 {
    |
 
 error[E0425]: cannot find function, tuple struct or tuple variant `Bar` in this scope
@@ -31,7 +32,8 @@ LL |     Baz();
    |     ~~~
 help: consider importing this function
    |
-LL | use foo2::Bar;
+LL + use foo2::Bar;
+LL | pub mod foo1 {
    |
 
 error[E0412]: cannot find type `Bar` in this scope
@@ -49,7 +51,8 @@ LL |     let _x: Box<Baz>;
    |                 ~~~
 help: consider importing this trait
    |
-LL | use foo1::Bar;
+LL + use foo1::Bar;
+LL | pub mod foo1 {
    |
 
 error[E0747]: constant provided when a type was expected
diff --git a/tests/ui/privacy/privacy-ns2.stderr b/tests/ui/privacy/privacy-ns2.stderr
index 904e9013f94..73a24bd20f3 100644
--- a/tests/ui/privacy/privacy-ns2.stderr
+++ b/tests/ui/privacy/privacy-ns2.stderr
@@ -6,7 +6,8 @@ LL |     Bar();
    |
 help: consider importing this function instead
    |
-LL | use foo2::Bar;
+LL + use foo2::Bar;
+LL | pub mod foo1 {
    |
 
 error[E0423]: expected function, tuple struct or tuple variant, found trait `Bar`
@@ -24,7 +25,8 @@ LL |     Baz();
    |     ~~~
 help: consider importing this function instead
    |
-LL | use foo2::Bar;
+LL + use foo2::Bar;
+LL | pub mod foo1 {
    |
 
 error[E0573]: expected type, found function `Bar`
@@ -39,7 +41,8 @@ LL |     let _x = Bar();
    |            ~
 help: consider importing this trait instead
    |
-LL | use foo1::Bar;
+LL + use foo1::Bar;
+LL | pub mod foo1 {
    |
 
 error[E0603]: trait `Bar` is private
diff --git a/tests/ui/proc-macro/amputate-span.stderr b/tests/ui/proc-macro/amputate-span.stderr
index ab467041144..fa83707e79d 100644
--- a/tests/ui/proc-macro/amputate-span.stderr
+++ b/tests/ui/proc-macro/amputate-span.stderr
@@ -6,7 +6,8 @@ LL |     Command::new("git");
    |
 help: consider importing this struct
    |
-LL | use std::process::Command;
+LL + use std::process::Command;
+LL | #[amputate_span::drop_first_token]
    |
 
 error[E0433]: failed to resolve: use of undeclared type `Command`
@@ -17,7 +18,8 @@ LL |         Command::new("git");
    |
 help: consider importing this struct
    |
-LL |     use std::process::Command;
+LL +     use std::process::Command;
+LL |     #[amputate_span::drop_first_token]
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/proc-macro/attributes-on-modules-fail.stderr b/tests/ui/proc-macro/attributes-on-modules-fail.stderr
index bb6cbb6984d..a0ab9999c08 100644
--- a/tests/ui/proc-macro/attributes-on-modules-fail.stderr
+++ b/tests/ui/proc-macro/attributes-on-modules-fail.stderr
@@ -50,7 +50,8 @@ LL |     type A = Y;
    |
 help: consider importing this struct
    |
-LL |     use Y;
+LL +     use Y;
+LL |     pub struct X;
    |
 
 error[E0412]: cannot find type `X` in this scope
@@ -61,7 +62,8 @@ LL | type A = X;
    |
 help: consider importing this struct
    |
-LL | use m::X;
+LL + use m::X;
+LL | #[macro_use]
    |
 
 error: aborting due to 7 previous errors
diff --git a/tests/ui/repeat-expr/repeat-to-run-dtor-twice.stderr b/tests/ui/repeat-expr/repeat-to-run-dtor-twice.stderr
index 36b93616375..1bf8e6e062f 100644
--- a/tests/ui/repeat-expr/repeat-to-run-dtor-twice.stderr
+++ b/tests/ui/repeat-expr/repeat-to-run-dtor-twice.stderr
@@ -7,7 +7,8 @@ LL |     let _ = [ a; 5 ];
    = note: the `Copy` trait is required because this value will be copied for each element of the array
 help: consider annotating `Foo` with `#[derive(Copy)]`
    |
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct Foo {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/resolve/crate-in-paths.stderr b/tests/ui/resolve/crate-in-paths.stderr
index b7cf4950759..45ecf5a59ad 100644
--- a/tests/ui/resolve/crate-in-paths.stderr
+++ b/tests/ui/resolve/crate-in-paths.stderr
@@ -6,7 +6,8 @@ LL |     Foo;
    |
 help: consider importing this unit struct
    |
-LL | use crate::bar::Foo;
+LL + use crate::bar::Foo;
+LL | mod bar {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/resolve/enums-are-namespaced-xc.stderr b/tests/ui/resolve/enums-are-namespaced-xc.stderr
index 6448e596d56..efebf15684b 100644
--- a/tests/ui/resolve/enums-are-namespaced-xc.stderr
+++ b/tests/ui/resolve/enums-are-namespaced-xc.stderr
@@ -6,7 +6,8 @@ LL |     let _ = namespaced_enums::A;
    |
 help: consider importing this unit variant
    |
-LL | use namespaced_enums::Foo::A;
+LL + use namespaced_enums::Foo::A;
+LL | extern crate namespaced_enums;
    |
 help: if you import `A`, refer to it directly
    |
@@ -22,7 +23,8 @@ LL |     let _ = namespaced_enums::B(10);
    |
 help: consider importing this tuple variant
    |
-LL | use namespaced_enums::Foo::B;
+LL + use namespaced_enums::Foo::B;
+LL | extern crate namespaced_enums;
    |
 help: if you import `B`, refer to it directly
    |
@@ -38,7 +40,8 @@ LL |     let _ = namespaced_enums::C { a: 10 };
    |
 help: consider importing this variant
    |
-LL | use namespaced_enums::Foo::C;
+LL + use namespaced_enums::Foo::C;
+LL | extern crate namespaced_enums;
    |
 help: if you import `C`, refer to it directly
    |
diff --git a/tests/ui/resolve/filter-intrinsics.stderr b/tests/ui/resolve/filter-intrinsics.stderr
index 955070891fb..3b4a09a25e7 100644
--- a/tests/ui/resolve/filter-intrinsics.stderr
+++ b/tests/ui/resolve/filter-intrinsics.stderr
@@ -6,7 +6,8 @@ LL |     let _ = size_of::<usize>();
    |
 help: consider importing this function
    |
-LL | use std::mem::size_of;
+LL + use std::mem::size_of;
+LL | fn main() {
    |
 
 error[E0425]: cannot find function `fabsf64` in this scope
@@ -17,7 +18,8 @@ LL |     let _ = fabsf64(1.0);
    |
 help: consider importing this function
    |
-LL | use std::intrinsics::fabsf64;
+LL + use std::intrinsics::fabsf64;
+LL | fn main() {
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/resolve/issue-102946.stderr b/tests/ui/resolve/issue-102946.stderr
index 65be0258e6d..73843849214 100644
--- a/tests/ui/resolve/issue-102946.stderr
+++ b/tests/ui/resolve/issue-102946.stderr
@@ -6,7 +6,8 @@ LL | impl Error for str::Utf8Error {
    |
 help: consider importing this trait
    |
-LL | use std::error::Error;
+LL + use std::error::Error;
+LL | impl Error for str::Utf8Error {
    |
 
 error[E0223]: ambiguous associated type
diff --git a/tests/ui/resolve/issue-16058.stderr b/tests/ui/resolve/issue-16058.stderr
index c47d22cef5f..65dba047234 100644
--- a/tests/ui/resolve/issue-16058.stderr
+++ b/tests/ui/resolve/issue-16058.stderr
@@ -6,11 +6,14 @@ LL |         Result {
    |
 help: consider importing one of these items instead
    |
-LL | use std::fmt::Result;
+LL + use std::fmt::Result;
+LL | pub struct GslResult {
    |
-LL | use std::io::Result;
+LL + use std::io::Result;
+LL | pub struct GslResult {
    |
-LL | use std::thread::Result;
+LL + use std::thread::Result;
+LL | pub struct GslResult {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/resolve/issue-17518.stderr b/tests/ui/resolve/issue-17518.stderr
index 034d0d01bfb..19b59b841e0 100644
--- a/tests/ui/resolve/issue-17518.stderr
+++ b/tests/ui/resolve/issue-17518.stderr
@@ -6,7 +6,8 @@ LL |     E { name: "foobar" };
    |
 help: consider importing this variant
    |
-LL | use SomeEnum::E;
+LL + use SomeEnum::E;
+LL | enum SomeEnum {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/resolve/issue-21221-1.stderr b/tests/ui/resolve/issue-21221-1.stderr
index 538eeead9fc..836ea564f4e 100644
--- a/tests/ui/resolve/issue-21221-1.stderr
+++ b/tests/ui/resolve/issue-21221-1.stderr
@@ -6,11 +6,14 @@ LL | impl Mul for Foo {
    |
 help: consider importing one of these items
    |
-LL | use mul1::Mul;
+LL + use mul1::Mul;
+LL | mod mul1 {
    |
-LL | use mul2::Mul;
+LL + use mul2::Mul;
+LL | mod mul1 {
    |
-LL | use std::ops::Mul;
+LL + use std::ops::Mul;
+LL | mod mul1 {
    |
 
 error[E0412]: cannot find type `Mul` in this scope
@@ -21,11 +24,14 @@ LL | fn getMul() -> Mul {
    |
 help: consider importing one of these items
    |
-LL | use mul1::Mul;
+LL + use mul1::Mul;
+LL | mod mul1 {
    |
-LL | use mul2::Mul;
+LL + use mul2::Mul;
+LL | mod mul1 {
    |
-LL | use std::ops::Mul;
+LL + use std::ops::Mul;
+LL | mod mul1 {
    |
 
 error[E0405]: cannot find trait `ThisTraitReallyDoesntExistInAnyModuleReally` in this scope
@@ -42,7 +48,8 @@ LL | impl Div for Foo {
    |
 help: consider importing this trait
    |
-LL | use std::ops::Div;
+LL + use std::ops::Div;
+LL | mod mul1 {
    |
 
 error: aborting due to 4 previous errors
diff --git a/tests/ui/resolve/issue-21221-2.stderr b/tests/ui/resolve/issue-21221-2.stderr
index d4fd7cb1257..e88274e6c60 100644
--- a/tests/ui/resolve/issue-21221-2.stderr
+++ b/tests/ui/resolve/issue-21221-2.stderr
@@ -6,9 +6,11 @@ LL | impl T for Foo { }
    |
 help: consider importing one of these items
    |
-LL | use baz::T;
+LL + use baz::T;
+LL | pub mod foo {
    |
-LL | use foo::bar::T;
+LL + use foo::bar::T;
+LL | pub mod foo {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/resolve/issue-21221-3.stderr b/tests/ui/resolve/issue-21221-3.stderr
index f12e5b09bac..e02eaec05e3 100644
--- a/tests/ui/resolve/issue-21221-3.stderr
+++ b/tests/ui/resolve/issue-21221-3.stderr
@@ -6,7 +6,8 @@ LL | impl OuterTrait for Foo {}
    |
 help: consider importing this trait
    |
-LL | use issue_21221_3::outer::OuterTrait;
+LL + use issue_21221_3::outer::OuterTrait;
+LL | extern crate issue_21221_3;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/resolve/issue-21221-4.stderr b/tests/ui/resolve/issue-21221-4.stderr
index fc15444d0c0..e8c38ed6acf 100644
--- a/tests/ui/resolve/issue-21221-4.stderr
+++ b/tests/ui/resolve/issue-21221-4.stderr
@@ -6,7 +6,8 @@ LL | impl T for Foo {}
    |
 help: consider importing this trait
    |
-LL | use issue_21221_4::T;
+LL + use issue_21221_4::T;
+LL | extern crate issue_21221_4;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/resolve/issue-2356.stderr b/tests/ui/resolve/issue-2356.stderr
index 36f3da7c955..ed820f15c83 100644
--- a/tests/ui/resolve/issue-2356.stderr
+++ b/tests/ui/resolve/issue-2356.stderr
@@ -10,7 +10,8 @@ LL |     Self::default();
    |     ~~~~~~~~~~~~~
 help: consider importing this function
    |
-LL | use std::default::default;
+LL + use std::default::default;
+LL | trait Groom {
    |
 
 error[E0425]: cannot find value `whiskers` in this scope
diff --git a/tests/ui/resolve/issue-26545.stderr b/tests/ui/resolve/issue-26545.stderr
index d3c86692501..2b98b5b8a7b 100644
--- a/tests/ui/resolve/issue-26545.stderr
+++ b/tests/ui/resolve/issue-26545.stderr
@@ -6,7 +6,8 @@ LL |         B(());
    |
 help: consider importing this tuple struct
    |
-LL |     use foo::B;
+LL +     use foo::B;
+LL |     fn foo() {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/resolve/issue-35675.stderr b/tests/ui/resolve/issue-35675.stderr
index 4a06196d548..d2856145371 100644
--- a/tests/ui/resolve/issue-35675.stderr
+++ b/tests/ui/resolve/issue-35675.stderr
@@ -17,7 +17,8 @@ LL |     Apple(5)
    |
 help: consider importing this tuple variant
    |
-LL | use Fruit::Apple;
+LL + use Fruit::Apple;
+LL | enum Fruit {
    |
 
 error[E0573]: expected type, found variant `Fruit::Apple`
@@ -37,7 +38,8 @@ LL |     Apple(5)
    |
 help: consider importing this tuple variant
    |
-LL | use Fruit::Apple;
+LL + use Fruit::Apple;
+LL | enum Fruit {
    |
 
 error[E0573]: expected type, found variant `Ok`
diff --git a/tests/ui/resolve/issue-3907.stderr b/tests/ui/resolve/issue-3907.stderr
index 6fc61cae843..50ad668f8db 100644
--- a/tests/ui/resolve/issue-3907.stderr
+++ b/tests/ui/resolve/issue-3907.stderr
@@ -10,7 +10,8 @@ LL | trait Foo = dyn issue_3907::Foo;
    |
 help: consider importing this trait instead
    |
-LL | use issue_3907::Foo;
+LL + use issue_3907::Foo;
+LL | extern crate issue_3907;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/resolve/issue-50599.stderr b/tests/ui/resolve/issue-50599.stderr
index b07482c83cc..548d215b00a 100644
--- a/tests/ui/resolve/issue-50599.stderr
+++ b/tests/ui/resolve/issue-50599.stderr
@@ -6,9 +6,11 @@ LL |     const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize;
    |
 help: consider importing one of these items
    |
-LL | use std::f32::consts::LOG10_2;
+LL + use std::f32::consts::LOG10_2;
+LL | fn main() {
    |
-LL | use std::f64::consts::LOG10_2;
+LL + use std::f64::consts::LOG10_2;
+LL | fn main() {
    |
 help: if you import `LOG10_2`, refer to it directly
    |
diff --git a/tests/ui/resolve/issue-73427.stderr b/tests/ui/resolve/issue-73427.stderr
index 4af5f29d809..5a663ae79bc 100644
--- a/tests/ui/resolve/issue-73427.stderr
+++ b/tests/ui/resolve/issue-73427.stderr
@@ -107,9 +107,11 @@ LL |     (E::TupleWithFields(/* fields */)).foo();
    |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 help: consider importing one of these items instead
    |
-LL | use std::f32::consts::E;
+LL + use std::f32::consts::E;
+LL | enum A {
    |
-LL | use std::f64::consts::E;
+LL + use std::f64::consts::E;
+LL | enum A {
    |
 
 error[E0532]: expected tuple struct or tuple variant, found enum `A`
diff --git a/tests/ui/resolve/issue-90113.stderr b/tests/ui/resolve/issue-90113.stderr
index 1b78720571c..a9d4b573f11 100644
--- a/tests/ui/resolve/issue-90113.stderr
+++ b/tests/ui/resolve/issue-90113.stderr
@@ -6,7 +6,8 @@ LL |         Cons(..) => {}
    |
 help: consider importing this tuple variant
    |
-LL | use list::List::Cons;
+LL + use list::List::Cons;
+LL | mod list {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/resolve/missing-in-namespace.stderr b/tests/ui/resolve/missing-in-namespace.stderr
index fc925ba3b6a..66f40102a3e 100644
--- a/tests/ui/resolve/missing-in-namespace.stderr
+++ b/tests/ui/resolve/missing-in-namespace.stderr
@@ -6,7 +6,8 @@ LL |     let _map = std::hahmap::HashMap::new();
    |
 help: consider importing this struct
    |
-LL | use std::collections::HashMap;
+LL + use std::collections::HashMap;
+LL | fn main() {
    |
 help: if you import `HashMap`, refer to it directly
    |
diff --git a/tests/ui/resolve/no-implicit-prelude-nested.stderr b/tests/ui/resolve/no-implicit-prelude-nested.stderr
index 198b630c52c..4df6c31d316 100644
--- a/tests/ui/resolve/no-implicit-prelude-nested.stderr
+++ b/tests/ui/resolve/no-implicit-prelude-nested.stderr
@@ -6,7 +6,8 @@ LL |         impl Add for Test {}
    |
 help: consider importing this trait
    |
-LL |         use std::ops::Add;
+LL +         use std::ops::Add;
+LL |         struct Test;
    |
 
 error[E0404]: expected trait, found derive macro `Clone`
@@ -17,7 +18,8 @@ LL |         impl Clone for Test {}
    |
 help: consider importing this trait instead
    |
-LL |         use std::clone::Clone;
+LL +         use std::clone::Clone;
+LL |         struct Test;
    |
 
 error[E0405]: cannot find trait `Iterator` in this scope
@@ -28,7 +30,8 @@ LL |         impl Iterator for Test {}
    |
 help: consider importing this trait
    |
-LL |         use std::iter::Iterator;
+LL +         use std::iter::Iterator;
+LL |         struct Test;
    |
 
 error[E0405]: cannot find trait `ToString` in this scope
@@ -39,7 +42,8 @@ LL |         impl ToString for Test {}
    |
 help: consider importing this trait
    |
-LL |         use std::string::ToString;
+LL +         use std::string::ToString;
+LL |         struct Test;
    |
 
 error[E0405]: cannot find trait `Writer` in this scope
@@ -56,7 +60,8 @@ LL |             drop(2)
    |
 help: consider importing this function
    |
-LL |         use std::mem::drop;
+LL +         use std::mem::drop;
+LL |         struct Test;
    |
 
 error[E0405]: cannot find trait `Add` in this scope
@@ -67,7 +72,8 @@ LL |     impl Add for Test {}
    |
 help: consider importing this trait
    |
-LL |     use std::ops::Add;
+LL +     use std::ops::Add;
+LL |     mod baz {
    |
 
 error[E0404]: expected trait, found derive macro `Clone`
@@ -78,7 +84,8 @@ LL |     impl Clone for Test {}
    |
 help: consider importing this trait instead
    |
-LL |     use std::clone::Clone;
+LL +     use std::clone::Clone;
+LL |     mod baz {
    |
 
 error[E0405]: cannot find trait `Iterator` in this scope
@@ -89,7 +96,8 @@ LL |     impl Iterator for Test {}
    |
 help: consider importing this trait
    |
-LL |     use std::iter::Iterator;
+LL +     use std::iter::Iterator;
+LL |     mod baz {
    |
 
 error[E0405]: cannot find trait `ToString` in this scope
@@ -100,7 +108,8 @@ LL |     impl ToString for Test {}
    |
 help: consider importing this trait
    |
-LL |     use std::string::ToString;
+LL +     use std::string::ToString;
+LL |     mod baz {
    |
 
 error[E0405]: cannot find trait `Writer` in this scope
@@ -117,7 +126,8 @@ LL |         drop(2)
    |
 help: consider importing this function
    |
-LL |     use std::mem::drop;
+LL +     use std::mem::drop;
+LL |     mod baz {
    |
 
 error[E0405]: cannot find trait `Add` in this scope
@@ -128,7 +138,8 @@ LL |         impl Add for Test {}
    |
 help: consider importing this trait
    |
-LL |         use std::ops::Add;
+LL +         use std::ops::Add;
+LL |         struct Test;
    |
 
 error[E0404]: expected trait, found derive macro `Clone`
@@ -139,7 +150,8 @@ LL |         impl Clone for Test {}
    |
 help: consider importing this trait instead
    |
-LL |         use std::clone::Clone;
+LL +         use std::clone::Clone;
+LL |         struct Test;
    |
 
 error[E0405]: cannot find trait `Iterator` in this scope
@@ -150,7 +162,8 @@ LL |         impl Iterator for Test {}
    |
 help: consider importing this trait
    |
-LL |         use std::iter::Iterator;
+LL +         use std::iter::Iterator;
+LL |         struct Test;
    |
 
 error[E0405]: cannot find trait `ToString` in this scope
@@ -161,7 +174,8 @@ LL |         impl ToString for Test {}
    |
 help: consider importing this trait
    |
-LL |         use std::string::ToString;
+LL +         use std::string::ToString;
+LL |         struct Test;
    |
 
 error[E0405]: cannot find trait `Writer` in this scope
@@ -178,7 +192,8 @@ LL |             drop(2)
    |
 help: consider importing this function
    |
-LL |         use std::mem::drop;
+LL +         use std::mem::drop;
+LL |         struct Test;
    |
 
 error: aborting due to 18 previous errors
diff --git a/tests/ui/resolve/no-implicit-prelude.stderr b/tests/ui/resolve/no-implicit-prelude.stderr
index 36a9b65b7d1..a8e5f1b69e2 100644
--- a/tests/ui/resolve/no-implicit-prelude.stderr
+++ b/tests/ui/resolve/no-implicit-prelude.stderr
@@ -6,7 +6,8 @@ LL | impl Add for Test {}
    |
 help: consider importing this trait
    |
-LL | use std::ops::Add;
+LL + use std::ops::Add;
+LL | struct Test;
    |
 
 error[E0404]: expected trait, found derive macro `Clone`
@@ -17,7 +18,8 @@ LL | impl Clone for Test {}
    |
 help: consider importing this trait instead
    |
-LL | use std::clone::Clone;
+LL + use std::clone::Clone;
+LL | struct Test;
    |
 
 error[E0405]: cannot find trait `Iterator` in this scope
@@ -28,7 +30,8 @@ LL | impl Iterator for Test {}
    |
 help: consider importing this trait
    |
-LL | use std::iter::Iterator;
+LL + use std::iter::Iterator;
+LL | struct Test;
    |
 
 error[E0405]: cannot find trait `ToString` in this scope
@@ -39,7 +42,8 @@ LL | impl ToString for Test {}
    |
 help: consider importing this trait
    |
-LL | use std::string::ToString;
+LL + use std::string::ToString;
+LL | struct Test;
    |
 
 error[E0405]: cannot find trait `Writer` in this scope
@@ -56,7 +60,8 @@ LL |     drop(2)
    |
 help: consider importing this function
    |
-LL | use std::mem::drop;
+LL + use std::mem::drop;
+LL | struct Test;
    |
 
 error: aborting due to 6 previous errors
diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr
index 3c051429fd0..76dc25539d0 100644
--- a/tests/ui/resolve/privacy-enum-ctor.stderr
+++ b/tests/ui/resolve/privacy-enum-ctor.stderr
@@ -84,9 +84,11 @@ LL |     let _: E = m::f;
    |                   ~
 help: consider importing one of these items instead
    |
-LL | use std::f32::consts::E;
+LL + use std::f32::consts::E;
+LL | use m::E; // OK, only the type is imported
    |
-LL | use std::f64::consts::E;
+LL + use std::f64::consts::E;
+LL | use m::E; // OK, only the type is imported
    |
 help: if you import `E`, refer to it directly
    |
@@ -121,9 +123,11 @@ LL |     let _: E = (E::Fn(/* fields */));
    |                ~~~~~~~~~~~~~~~~~~~~~
 help: consider importing one of these items instead
    |
-LL | use std::f32::consts::E;
+LL + use std::f32::consts::E;
+LL | use m::E; // OK, only the type is imported
    |
-LL | use std::f64::consts::E;
+LL + use std::f64::consts::E;
+LL | use m::E; // OK, only the type is imported
    |
 
 error[E0412]: cannot find type `Z` in this scope
diff --git a/tests/ui/resolve/resolve-primitive-fallback.stderr b/tests/ui/resolve/resolve-primitive-fallback.stderr
index f803f9da2af..2227522d6ea 100644
--- a/tests/ui/resolve/resolve-primitive-fallback.stderr
+++ b/tests/ui/resolve/resolve-primitive-fallback.stderr
@@ -12,7 +12,8 @@ LL |     let _: ::u8;
    |
 help: consider importing this builtin type
    |
-LL | use std::primitive::u8;
+LL + use std::primitive::u8;
+LL | fn main() {
    |
 help: if you import `u8`, refer to it directly
    |
diff --git a/tests/ui/resolve/use_suggestion.stderr b/tests/ui/resolve/use_suggestion.stderr
index 54ad853831f..a30dbd954e1 100644
--- a/tests/ui/resolve/use_suggestion.stderr
+++ b/tests/ui/resolve/use_suggestion.stderr
@@ -6,7 +6,8 @@ LL |     let x1 = HashMap::new();
    |
 help: consider importing this struct
    |
-LL | use std::collections::HashMap;
+LL + use std::collections::HashMap;
+LL | fn main() {
    |
 
 error[E0412]: cannot find type `HashMap` in this scope
@@ -17,7 +18,8 @@ LL |     let y1: HashMap;
    |
 help: consider importing this struct
    |
-LL | use std::collections::HashMap;
+LL + use std::collections::HashMap;
+LL | fn main() {
    |
 
 error[E0412]: cannot find type `GooMap` in this scope
diff --git a/tests/ui/resolve/use_suggestion_placement.stderr b/tests/ui/resolve/use_suggestion_placement.stderr
index 0aadd82f6c2..9288530ad2e 100644
--- a/tests/ui/resolve/use_suggestion_placement.stderr
+++ b/tests/ui/resolve/use_suggestion_placement.stderr
@@ -6,7 +6,8 @@ LL |     type Bar = Path;
    |
 help: consider importing this struct
    |
-LL |     use std::path::Path;
+LL +     use std::path::Path;
+LL |     #[derive(Debug)]
    |
 
 error[E0425]: cannot find value `A` in this scope
@@ -17,7 +18,8 @@ LL |     let _ = A;
    |
 help: consider importing this constant
    |
-LL | use m::A;
+LL + use m::A;
+LL | macro_rules! y {
    |
 
 error[E0412]: cannot find type `HashMap` in this scope
@@ -28,7 +30,8 @@ LL |     type Dict<K, V> = HashMap<K, V>;
    |
 help: consider importing this struct
    |
-LL | use std::collections::HashMap;
+LL + use std::collections::HashMap;
+LL | macro_rules! y {
    |
 
 error: aborting due to 3 previous errors
diff --git a/tests/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr b/tests/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr
index d8b5a9e6364..ce165e64632 100644
--- a/tests/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr
+++ b/tests/ui/rfc-2361-dbg-macro/dbg-macro-requires-debug.stderr
@@ -9,7 +9,8 @@ LL |     let _: NotDebug = dbg!(NotDebug);
    = note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `NotDebug` with `#[derive(Debug)]`
    |
-LL | #[derive(Debug)]
+LL + #[derive(Debug)]
+LL | struct NotDebug;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.stderr b/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.stderr
index 6b6c578bff8..653037ef398 100644
--- a/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.stderr
+++ b/tests/ui/rfc-2632-const-trait-impl/const_derives/derive-const-non-const-type.stderr
@@ -16,7 +16,8 @@ LL | pub struct S(A);
    = note: this error originates in the derive macro `Default` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `A` with `#[derive(Default)]`
    |
-LL | #[derive(Default)]
+LL + #[derive(Default)]
+LL | pub struct A;
    |
 
 error[E0015]: cannot call non-const fn `<A as Default>::default` in constant functions
diff --git a/tests/ui/rust-2018/issue-52202-use-suggestions.stderr b/tests/ui/rust-2018/issue-52202-use-suggestions.stderr
index 38cd9713d1a..5450ede8223 100644
--- a/tests/ui/rust-2018/issue-52202-use-suggestions.stderr
+++ b/tests/ui/rust-2018/issue-52202-use-suggestions.stderr
@@ -6,13 +6,17 @@ LL |     let _d = Drain {};
    |
 help: consider importing one of these items
    |
-LL | use crate::plumbing::Drain;
+LL + use crate::plumbing::Drain;
+LL | mod plumbing {
    |
-LL | use std::collections::binary_heap::Drain;
+LL + use std::collections::binary_heap::Drain;
+LL | mod plumbing {
    |
-LL | use std::collections::hash_map::Drain;
+LL + use std::collections::hash_map::Drain;
+LL | mod plumbing {
    |
-LL | use std::collections::hash_set::Drain;
+LL + use std::collections::hash_set::Drain;
+LL | mod plumbing {
    |
      and 3 other candidates
 
diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr
index 6454b6045e4..4be5c7b0d0c 100644
--- a/tests/ui/rust-2018/trait-import-suggestions.stderr
+++ b/tests/ui/rust-2018/trait-import-suggestions.stderr
@@ -10,7 +10,8 @@ LL |         x.foobar();
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL |     use crate::foo::foobar::Foobar;
+LL +     use crate::foo::foobar::Foobar;
+LL |     mod foobar {
    |
 
 error[E0599]: no method named `bar` found for type `u32` in the current scope
@@ -25,7 +26,8 @@ LL |     x.bar();
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use crate::foo::Bar;
+LL + use crate::foo::Bar;
+LL | mod foo {
    |
 
 error[E0599]: no method named `baz` found for type `u32` in the current scope
@@ -43,7 +45,8 @@ LL |     let y = u32::from_str("33");
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use std::str::FromStr;
+LL + use std::str::FromStr;
+LL | mod foo {
    |
 help: there is an associated function with a similar name
    |
diff --git a/tests/ui/rust-2018/uniform-paths/issue-87932.stderr b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr
index b52720ae3d9..e5e17f22c5f 100644
--- a/tests/ui/rust-2018/uniform-paths/issue-87932.stderr
+++ b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr
@@ -10,7 +10,8 @@ LL |     A::deserialize();
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use <crate::A as issue_87932_a::Deserialize>::deserialize::_a::Deserialize;
+LL + use <crate::A as issue_87932_a::Deserialize>::deserialize::_a::Deserialize;
+LL | pub struct A {}
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr
index 3d21b735aea..34bf68e8913 100644
--- a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr
+++ b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr
@@ -8,9 +8,11 @@ LL |         let _: u32 = 3u8.try_into().unwrap();
    = note: 'std::convert::TryInto' is included in the prelude starting in Edition 2021
 help: the following traits are implemented but not in scope; perhaps add a `use` for one of them:
    |
-LL |     use crate::m::TryIntoU32;
+LL +     use crate::m::TryIntoU32;
+LL |     use crate::m::AnotherTrick as TryIntoU32;
    |
-LL |     use std::convert::TryInto;
+LL +     use std::convert::TryInto;
+LL |     use crate::m::AnotherTrick as TryIntoU32;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/self/class-missing-self.stderr b/tests/ui/self/class-missing-self.stderr
index 063c3f013c5..2f35b30dbcb 100644
--- a/tests/ui/self/class-missing-self.stderr
+++ b/tests/ui/self/class-missing-self.stderr
@@ -16,7 +16,8 @@ LL |       self.sleep();
    |       +++++
 help: consider importing this function
    |
-LL | use std::thread::sleep;
+LL + use std::thread::sleep;
+LL | struct Cat {
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/shadowed/shadowed-trait-methods.stderr b/tests/ui/shadowed/shadowed-trait-methods.stderr
index c3b9084affd..6d7ab27f3e1 100644
--- a/tests/ui/shadowed/shadowed-trait-methods.stderr
+++ b/tests/ui/shadowed/shadowed-trait-methods.stderr
@@ -10,7 +10,8 @@ LL |     ().f()
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use foo::T;
+LL + use foo::T;
+LL | mod foo {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr
index 37b2f413860..626cc67d9eb 100644
--- a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr
+++ b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr
@@ -15,7 +15,8 @@ LL |         interval: Duration,
    |
 help: consider importing this struct
    |
-LL | use std::time::Duration;
+LL + use std::time::Duration;
+LL | fn main() {}
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/span/issue-35987.stderr b/tests/ui/span/issue-35987.stderr
index 057d40ac0cb..0e64bcb0106 100644
--- a/tests/ui/span/issue-35987.stderr
+++ b/tests/ui/span/issue-35987.stderr
@@ -11,6 +11,7 @@ LL | impl<T: Clone, Add> Add for Foo<T> {
    |
 help: consider importing this trait instead
    |
+LL + use std::ops::Add;
 LL | use std::ops::Add;
    |
 
diff --git a/tests/ui/span/issue-71363.stderr b/tests/ui/span/issue-71363.stderr
index cb5cc320276..90b623e89cf 100644
--- a/tests/ui/span/issue-71363.stderr
+++ b/tests/ui/span/issue-71363.stderr
@@ -21,7 +21,8 @@ note: required by a bound in `std::error::Error`
  --> $SRC_DIR/core/src/error.rs:LL:COL
 help: consider annotating `MyError` with `#[derive(Debug)]`
   |
-3 | #[derive(Debug)]
+3 + #[derive(Debug)]
+4 | struct MyError;
   |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/specialization/issue-59435.stderr b/tests/ui/specialization/issue-59435.stderr
index 21145940668..e8a12e4d928 100644
--- a/tests/ui/specialization/issue-59435.stderr
+++ b/tests/ui/specialization/issue-59435.stderr
@@ -11,7 +11,8 @@ LL |     type MyType: Default;
    |                  ^^^^^^^ required by this bound in `MyTrait::MyType`
 help: consider annotating `MyStruct` with `#[derive(Default)]`
    |
-LL | #[derive(Default)]
+LL + #[derive(Default)]
+LL | struct MyStruct {}
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/structs/struct-path-alias-bounds.stderr b/tests/ui/structs/struct-path-alias-bounds.stderr
index 266291f62b4..5b01208c56f 100644
--- a/tests/ui/structs/struct-path-alias-bounds.stderr
+++ b/tests/ui/structs/struct-path-alias-bounds.stderr
@@ -11,7 +11,8 @@ LL | struct S<T: Clone> { a: T }
    |             ^^^^^ required by this bound in `S`
 help: consider annotating `NoClone` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct NoClone;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr
index 45593035b9d..0716005c679 100644
--- a/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr
+++ b/tests/ui/suggestions/clone-on-unconstrained-borrowed-type-param.stderr
@@ -35,7 +35,8 @@ LL |     t.clone()
    |     ^
 help: consider annotating `Foo` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct Foo;
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/suggestions/core-std-import-order-issue-83564.stderr b/tests/ui/suggestions/core-std-import-order-issue-83564.stderr
index e4e1fc591c4..c87ff952553 100644
--- a/tests/ui/suggestions/core-std-import-order-issue-83564.stderr
+++ b/tests/ui/suggestions/core-std-import-order-issue-83564.stderr
@@ -6,9 +6,11 @@ LL |     let _x = NonZeroU32::new(5).unwrap();
    |
 help: consider importing one of these items
    |
-LL | use core::num::NonZeroU32;
+LL + use core::num::NonZeroU32;
+LL | fn main() {
    |
-LL | use std::num::NonZeroU32;
+LL + use std::num::NonZeroU32;
+LL | fn main() {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/suggestions/derive-macro-missing-bounds.stderr b/tests/ui/suggestions/derive-macro-missing-bounds.stderr
index 79036279df9..c3f305c1770 100644
--- a/tests/ui/suggestions/derive-macro-missing-bounds.stderr
+++ b/tests/ui/suggestions/derive-macro-missing-bounds.stderr
@@ -11,7 +11,8 @@ LL |     struct Outer<T>(Inner<T>);
    = note: this error originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `a::Inner<T>` with `#[derive(Debug)]`
    |
-LL |     #[derive(Debug)]
+LL +     #[derive(Debug)]
+LL |     struct Inner<T>(T);
    |
 help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
    |
diff --git a/tests/ui/suggestions/derive-trait-for-method-call.stderr b/tests/ui/suggestions/derive-trait-for-method-call.stderr
index 924b26a8c75..e2db0da74f0 100644
--- a/tests/ui/suggestions/derive-trait-for-method-call.stderr
+++ b/tests/ui/suggestions/derive-trait-for-method-call.stderr
@@ -32,7 +32,8 @@ note: the trait `Default` must be implemented
   --> $SRC_DIR/core/src/default.rs:LL:COL
 help: consider annotating `Enum` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | enum Enum {
    |
 
 error[E0599]: the method `test` exists for struct `Foo<Struct, CloneStruct>`, but its trait bounds were not satisfied
@@ -67,11 +68,13 @@ LL | impl<X: Clone + Default + , Y: Clone + Default> Foo<X, Y> {
    |         unsatisfied trait bound introduced here
 help: consider annotating `CloneStruct` with `#[derive(Default)]`
    |
-LL | #[derive(Default)]
+LL + #[derive(Default)]
+LL | struct CloneStruct {
    |
 help: consider annotating `Struct` with `#[derive(Clone, Default)]`
    |
-LL | #[derive(Clone, Default)]
+LL + #[derive(Clone, Default)]
+LL | struct Struct {
    |
 
 error[E0599]: the method `test` exists for struct `Foo<Vec<Enum>, Instant>`, but its trait bounds were not satisfied
diff --git a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr
index 4658ecb3a7a..6eced1d416e 100644
--- a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr
+++ b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr
@@ -10,9 +10,11 @@ LL |     banana::Chaenomeles.pick()
    = help: items from traits can only be used if the trait is in scope
 help: the following traits are implemented but not in scope; perhaps add a `use` for one of them:
    |
-LL | use banana::Apple;
+LL + use banana::Apple;
+LL | mod banana {
    |
-LL | use banana::Peach;
+LL + use banana::Peach;
+LL | mod banana {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/suggestions/import-trait-for-method-call.stderr b/tests/ui/suggestions/import-trait-for-method-call.stderr
index f159b51a269..464fe85ac17 100644
--- a/tests/ui/suggestions/import-trait-for-method-call.stderr
+++ b/tests/ui/suggestions/import-trait-for-method-call.stderr
@@ -10,7 +10,8 @@ LL |     h.finish()
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use std::hash::Hasher;
+LL + use std::hash::Hasher;
+LL | use std::hash::BuildHasher;
    |
 
 error[E0599]: the method `as_ref` exists for reference `&dyn Bar`, but its trait bounds were not satisfied
diff --git a/tests/ui/suggestions/invalid-bin-op.stderr b/tests/ui/suggestions/invalid-bin-op.stderr
index 08502dfeb2d..e291cedb835 100644
--- a/tests/ui/suggestions/invalid-bin-op.stderr
+++ b/tests/ui/suggestions/invalid-bin-op.stderr
@@ -13,7 +13,8 @@ LL | struct S<T>(T);
    | ^^^^^^^^^^^ must implement `PartialEq<_>`
 help: consider annotating `S<T>` with `#[derive(PartialEq)]`
    |
-LL | #[derive(PartialEq)]
+LL + #[derive(PartialEq)]
+LL | struct S<T>(T);
    |
 help: consider introducing a `where` clause, but there might be an alternative better way to express this requirement
    |
diff --git a/tests/ui/suggestions/issue-84973-blacklist.stderr b/tests/ui/suggestions/issue-84973-blacklist.stderr
index c20cc816484..1e243f81b10 100644
--- a/tests/ui/suggestions/issue-84973-blacklist.stderr
+++ b/tests/ui/suggestions/issue-84973-blacklist.stderr
@@ -27,7 +27,8 @@ LL | fn f_clone<T: Clone>(t: T) {}
    |               ^^^^^ required by this bound in `f_clone`
 help: consider annotating `S` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct S;
    |
 
 error[E0277]: `[static generator@$DIR/issue-84973-blacklist.rs:17:13: 17:22]` cannot be unpinned
diff --git a/tests/ui/suggestions/no-extern-crate-in-type.stderr b/tests/ui/suggestions/no-extern-crate-in-type.stderr
index 876eef2b624..d8e53229f49 100644
--- a/tests/ui/suggestions/no-extern-crate-in-type.stderr
+++ b/tests/ui/suggestions/no-extern-crate-in-type.stderr
@@ -6,7 +6,8 @@ LL | type Output = Option<Foo>;
    |
 help: consider importing this struct
    |
-LL | use foo::Foo;
+LL + use foo::Foo;
+LL | extern crate foo;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/suggestions/raw-name-use-suggestion.stderr b/tests/ui/suggestions/raw-name-use-suggestion.stderr
index 95c26b9ade8..733af9079d5 100644
--- a/tests/ui/suggestions/raw-name-use-suggestion.stderr
+++ b/tests/ui/suggestions/raw-name-use-suggestion.stderr
@@ -28,7 +28,8 @@ LL |     r#break();
    |
 help: consider importing this function
    |
-LL | use foo::r#break;
+LL + use foo::r#break;
+LL | mod foo {
    |
 
 error: aborting due to 3 previous errors
diff --git a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr
index 018083f9e03..525a5bc164d 100644
--- a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr
+++ b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr
@@ -8,9 +8,11 @@ LL |     let _i: i16 = TryFrom::try_from(0_i32).unwrap();
    = note: 'core::convert::TryFrom' is included in the prelude starting in Edition 2021
 help: consider importing one of these items
    |
-LL | use core::convert::TryFrom;
+LL + use core::convert::TryFrom;
+LL | fn test() {
    |
-LL | use std::convert::TryFrom;
+LL + use std::convert::TryFrom;
+LL | fn test() {
    |
 
 error[E0433]: failed to resolve: use of undeclared type `TryInto`
@@ -23,9 +25,11 @@ LL |     let _i: i16 = TryInto::try_into(0_i32).unwrap();
    = note: 'core::convert::TryInto' is included in the prelude starting in Edition 2021
 help: consider importing one of these items
    |
-LL | use core::convert::TryInto;
+LL + use core::convert::TryInto;
+LL | fn test() {
    |
-LL | use std::convert::TryInto;
+LL + use std::convert::TryInto;
+LL | fn test() {
    |
 
 error[E0433]: failed to resolve: use of undeclared type `FromIterator`
@@ -42,9 +46,11 @@ LL |     let _v: Vec<_> = IntoIterator::from_iter(&[1]);
    |                      ~~~~~~~~~~~~
 help: consider importing one of these items
    |
-LL | use core::iter::FromIterator;
+LL + use core::iter::FromIterator;
+LL | fn test() {
    |
-LL | use std::iter::FromIterator;
+LL + use std::iter::FromIterator;
+LL | fn test() {
    |
 
 error[E0599]: no method named `try_into` found for type `i32` in the current scope
@@ -60,7 +66,8 @@ LL |     let _i: i16 = 0_i32.try_into().unwrap();
    = note: 'std::convert::TryInto' is included in the prelude starting in Edition 2021
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use std::convert::TryInto;
+LL + use std::convert::TryInto;
+LL | fn test() {
    |
 
 error: aborting due to 4 previous errors
diff --git a/tests/ui/suggestions/use-placement-resolve.stderr b/tests/ui/suggestions/use-placement-resolve.stderr
index 9da9e8e2702..16cbc9edcef 100644
--- a/tests/ui/suggestions/use-placement-resolve.stderr
+++ b/tests/ui/suggestions/use-placement-resolve.stderr
@@ -6,7 +6,8 @@ LL | fn foobar<T: Debug>(x: T) {}
    |
 help: consider importing this trait instead
    |
-LL | use std::fmt::Debug;
+LL + use std::fmt::Debug;
+LL | fn main() {}
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/suggestions/use-placement-typeck.stderr b/tests/ui/suggestions/use-placement-typeck.stderr
index 3b2749773a1..dc0586302f5 100644
--- a/tests/ui/suggestions/use-placement-typeck.stderr
+++ b/tests/ui/suggestions/use-placement-typeck.stderr
@@ -13,7 +13,8 @@ LL |     pub struct S;
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use m::Foo;
+LL + use m::Foo;
+LL | fn main() {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/trait-bounds/impl-bound-with-references-error.stderr b/tests/ui/trait-bounds/impl-bound-with-references-error.stderr
index 95fd6bd504c..cc3b887cf07 100644
--- a/tests/ui/trait-bounds/impl-bound-with-references-error.stderr
+++ b/tests/ui/trait-bounds/impl-bound-with-references-error.stderr
@@ -6,7 +6,8 @@ LL |     T: Into<Cow<'static, str>>,
    |
 help: consider importing this enum
    |
-LL | use std::borrow::Cow;
+LL + use std::borrow::Cow;
+LL | pub enum LabelText {
    |
 
 error[E0119]: conflicting implementations of trait `From<LabelText>` for type `LabelText`
diff --git a/tests/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr b/tests/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr
index b297662955e..60a86cc8e41 100644
--- a/tests/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr
+++ b/tests/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr
@@ -6,7 +6,8 @@ LL |     pub struct A<H: A::Trait>(pub H);
    |
 help: consider importing this trait
    |
-LL |     use A::Trait;
+LL +     use A::Trait;
+LL |     pub struct A<H: A::Trait>(pub H);
    |
 help: if you import `Trait`, refer to it directly
    |
diff --git a/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr b/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr
index dc967d51298..e723c7c5181 100644
--- a/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr
+++ b/tests/ui/traits/inductive-overflow/supertrait-auto-trait.stderr
@@ -26,7 +26,8 @@ LL | fn copy<T: Magic>(x: T) -> (T, T) { (x, x) }
    |            ^^^^^ required by this bound in `copy`
 help: consider annotating `NoClone` with `#[derive(Copy)]`
    |
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct NoClone;
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/traits/issue-71136.stderr b/tests/ui/traits/issue-71136.stderr
index f541733929d..ef55796187e 100644
--- a/tests/ui/traits/issue-71136.stderr
+++ b/tests/ui/traits/issue-71136.stderr
@@ -11,7 +11,8 @@ LL |     the_foos: Vec<Foo>,
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `Foo` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct Foo(u8);
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/traits/issue-78372.stderr b/tests/ui/traits/issue-78372.stderr
index 8e7fd5f2557..f9c2c0d6dec 100644
--- a/tests/ui/traits/issue-78372.stderr
+++ b/tests/ui/traits/issue-78372.stderr
@@ -6,7 +6,8 @@ LL | struct Smaht<T, MISC>(PhantomData);
    |
 help: consider importing this struct
    |
-LL | use std::marker::PhantomData;
+LL + use std::marker::PhantomData;
+LL | use std::ops::DispatchFromDyn;
    |
 
 error[E0412]: cannot find type `U` in this scope
diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr
index 04995b3a17b..f505f36aaea 100644
--- a/tests/ui/traits/item-privacy.stderr
+++ b/tests/ui/traits/item-privacy.stderr
@@ -29,7 +29,8 @@ LL |     S.b();
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use method::B;
+LL + use method::B;
+LL | struct S;
    |
 
 error[E0624]: method `a` is private
@@ -69,7 +70,8 @@ LL |     S::b(&S);
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use method::B;
+LL + use method::B;
+LL | struct S;
    |
 
 error[E0624]: method `a` is private
@@ -109,7 +111,8 @@ LL |     S::B;
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use assoc_const::B;
+LL + use assoc_const::B;
+LL | struct S;
    |
 
 error[E0624]: associated constant `A` is private
diff --git a/tests/ui/traits/method-private.stderr b/tests/ui/traits/method-private.stderr
index 55656f21e00..2b047df75a0 100644
--- a/tests/ui/traits/method-private.stderr
+++ b/tests/ui/traits/method-private.stderr
@@ -10,7 +10,8 @@ LL |     foo.method();
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use inner::Bar;
+LL + use inner::Bar;
+LL | mod inner {
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/typeck/explain_clone_autoref.stderr b/tests/ui/typeck/explain_clone_autoref.stderr
index 4539da4389b..38cb7fe5518 100644
--- a/tests/ui/typeck/explain_clone_autoref.stderr
+++ b/tests/ui/typeck/explain_clone_autoref.stderr
@@ -14,7 +14,8 @@ LL |     nc.clone()
    |     ^^
 help: consider annotating `NotClone` with `#[derive(Clone)]`
    |
-LL | #[derive(Clone)]
+LL + #[derive(Clone)]
+LL | struct NotClone;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/typeck/issue-43189.stderr b/tests/ui/typeck/issue-43189.stderr
index caf7530b85a..fa8a6143622 100644
--- a/tests/ui/typeck/issue-43189.stderr
+++ b/tests/ui/typeck/issue-43189.stderr
@@ -12,7 +12,8 @@ LL |     fn a(&self) {}
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL | use xcrate_issue_43189_b::xcrate_issue_43189_a::A;
+LL + use xcrate_issue_43189_b::xcrate_issue_43189_a::A;
+LL | extern crate xcrate_issue_43189_b;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/underscore-imports/shadow.stderr b/tests/ui/underscore-imports/shadow.stderr
index 7faede4e6d0..b0ecf129ca3 100644
--- a/tests/ui/underscore-imports/shadow.stderr
+++ b/tests/ui/underscore-imports/shadow.stderr
@@ -7,7 +7,8 @@ LL |         x.deref();
    = help: items from traits can only be used if the trait is in scope
 help: the following trait is implemented but not in scope; perhaps add a `use` for it:
    |
-LL |     use std::ops::Deref;
+LL +     use std::ops::Deref;
+LL |     use crate::b::Shadow as _; // Only imports the struct
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/union/union-derive-clone.mirunsafeck.stderr b/tests/ui/union/union-derive-clone.mirunsafeck.stderr
index b80e8b988ad..4d23d230fa3 100644
--- a/tests/ui/union/union-derive-clone.mirunsafeck.stderr
+++ b/tests/ui/union/union-derive-clone.mirunsafeck.stderr
@@ -9,7 +9,8 @@ note: required by a bound in `AssertParamIsCopy`
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `U1` with `#[derive(Copy)]`
    |
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | union U1 {
    |
 
 error[E0599]: the method `clone` exists for union `U5<CloneNoCopy>`, but its trait bounds were not satisfied
@@ -34,7 +35,8 @@ LL | #[derive(Clone, Copy)]
    |          ^^^^^ unsatisfied trait bound introduced in this `derive` macro
 help: consider annotating `CloneNoCopy` with `#[derive(Clone, Copy)]`
    |
-LL | #[derive(Clone, Copy)]
+LL + #[derive(Clone, Copy)]
+LL | struct CloneNoCopy;
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/union/union-derive-clone.thirunsafeck.stderr b/tests/ui/union/union-derive-clone.thirunsafeck.stderr
index b80e8b988ad..4d23d230fa3 100644
--- a/tests/ui/union/union-derive-clone.thirunsafeck.stderr
+++ b/tests/ui/union/union-derive-clone.thirunsafeck.stderr
@@ -9,7 +9,8 @@ note: required by a bound in `AssertParamIsCopy`
    = note: this error originates in the derive macro `Clone` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `U1` with `#[derive(Copy)]`
    |
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | union U1 {
    |
 
 error[E0599]: the method `clone` exists for union `U5<CloneNoCopy>`, but its trait bounds were not satisfied
@@ -34,7 +35,8 @@ LL | #[derive(Clone, Copy)]
    |          ^^^^^ unsatisfied trait bound introduced in this `derive` macro
 help: consider annotating `CloneNoCopy` with `#[derive(Clone, Copy)]`
    |
-LL | #[derive(Clone, Copy)]
+LL + #[derive(Clone, Copy)]
+LL | struct CloneNoCopy;
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/union/union-derive-eq.mirunsafeck.stderr b/tests/ui/union/union-derive-eq.mirunsafeck.stderr
index 9e55390b54d..136cd883e26 100644
--- a/tests/ui/union/union-derive-eq.mirunsafeck.stderr
+++ b/tests/ui/union/union-derive-eq.mirunsafeck.stderr
@@ -12,7 +12,8 @@ note: required by a bound in `AssertParamIsEq`
    = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]`
    |
-LL | #[derive(Eq)]
+LL + #[derive(Eq)]
+LL | struct PartialEqNotEq;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/union/union-derive-eq.thirunsafeck.stderr b/tests/ui/union/union-derive-eq.thirunsafeck.stderr
index 9e55390b54d..136cd883e26 100644
--- a/tests/ui/union/union-derive-eq.thirunsafeck.stderr
+++ b/tests/ui/union/union-derive-eq.thirunsafeck.stderr
@@ -12,7 +12,8 @@ note: required by a bound in `AssertParamIsEq`
    = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
 help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]`
    |
-LL | #[derive(Eq)]
+LL + #[derive(Eq)]
+LL | struct PartialEqNotEq;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/unresolved/unresolved-candidates.stderr b/tests/ui/unresolved/unresolved-candidates.stderr
index ea737c567b9..53f63c1c840 100644
--- a/tests/ui/unresolved/unresolved-candidates.stderr
+++ b/tests/ui/unresolved/unresolved-candidates.stderr
@@ -17,7 +17,8 @@ LL |     impl Trait for () {}
    |
 help: consider importing this trait
    |
-LL |     use a::Trait;
+LL +     use a::Trait;
+LL |     impl Trait for () {}
    |
 
 error: aborting due to 2 previous errors
diff --git a/tests/ui/wf/wf-const-type.stderr b/tests/ui/wf/wf-const-type.stderr
index 85938364ede..617969720a6 100644
--- a/tests/ui/wf/wf-const-type.stderr
+++ b/tests/ui/wf/wf-const-type.stderr
@@ -12,7 +12,8 @@ LL | struct IsCopy<T:Copy> { t: T }
    |                 ^^^^ required by this bound in `IsCopy`
 help: consider annotating `NotCopy` with `#[derive(Copy)]`
    |
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct NotCopy;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/wf/wf-static-type.stderr b/tests/ui/wf/wf-static-type.stderr
index 16c6124b652..bb5a57834eb 100644
--- a/tests/ui/wf/wf-static-type.stderr
+++ b/tests/ui/wf/wf-static-type.stderr
@@ -12,7 +12,8 @@ LL | struct IsCopy<T:Copy> { t: T }
    |                 ^^^^ required by this bound in `IsCopy`
 help: consider annotating `NotCopy` with `#[derive(Copy)]`
    |
-LL | #[derive(Copy)]
+LL + #[derive(Copy)]
+LL | struct NotCopy;
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/where-clauses/where-clauses-method-unsatisfied.stderr b/tests/ui/where-clauses/where-clauses-method-unsatisfied.stderr
index e90502977ff..6cf71729514 100644
--- a/tests/ui/where-clauses/where-clauses-method-unsatisfied.stderr
+++ b/tests/ui/where-clauses/where-clauses-method-unsatisfied.stderr
@@ -11,7 +11,8 @@ LL |     fn equals(&self, u: &Foo<T>) -> bool where T : Eq {
    |                                                    ^^ required by this bound in `Foo::<T>::equals`
 help: consider annotating `Bar` with `#[derive(Eq)]`
    |
-LL | #[derive(Eq)]
+LL + #[derive(Eq)]
+LL | struct Bar; // does not implement Eq
    |
 
 error: aborting due to previous error
diff --git a/tests/ui/where-clauses/where-clauses-unsatisfied.stderr b/tests/ui/where-clauses/where-clauses-unsatisfied.stderr
index b1805a4522f..4d239bf4307 100644
--- a/tests/ui/where-clauses/where-clauses-unsatisfied.stderr
+++ b/tests/ui/where-clauses/where-clauses-unsatisfied.stderr
@@ -11,7 +11,8 @@ LL | fn equal<T>(a: &T, b: &T) -> bool where T : Eq { a == b }
    |                                             ^^ required by this bound in `equal`
 help: consider annotating `Struct` with `#[derive(Eq)]`
    |
-LL | #[derive(Eq)]
+LL + #[derive(Eq)]
+LL | struct Struct;
    |
 
 error: aborting due to previous error