about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2025-07-10 17:21:59 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-07-10 17:23:29 +0000
commit0674eca2f0c4ac45b7cf1a66fd4df44dfc603e7e (patch)
tree7b38cc4b009a00514dba53bc9ecf9057d35f1aa4
parent7dfc3e9af45ad54832c083baf0d2d0ca8e0d979a (diff)
downloadrust-0674eca2f0c4ac45b7cf1a66fd4df44dfc603e7e.tar.gz
rust-0674eca2f0c4ac45b7cf1a66fd4df44dfc603e7e.zip
Make `Diag::multipart_suggestions` always verbose
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs2
-rw-r--r--tests/ui/derives/deriving-copyclone.stderr30
-rw-r--r--tests/ui/for/issue-20605.current.stderr9
-rw-r--r--tests/ui/for/issue-20605.next.stderr9
-rw-r--r--tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr9
-rw-r--r--tests/ui/inference/deref-suggestion.stderr9
-rw-r--r--tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr9
-rw-r--r--tests/ui/static/bad-const-type.stderr9
-rw-r--r--tests/ui/suggestions/imm-ref-trait-object-literal.stderr10
-rw-r--r--tests/ui/suggestions/issue-104961.stderr10
-rw-r--r--tests/ui/suggestions/issue-52820.stderr11
-rw-r--r--tests/ui/suggestions/issue-53692.stderr23
-rw-r--r--tests/ui/suggestions/issue-59819.stderr10
-rw-r--r--tests/ui/suggestions/issue-62843.stderr10
-rw-r--r--tests/ui/suggestions/issue-83943.stderr9
-rw-r--r--tests/ui/suggestions/issue-84973-2.stderr10
-rw-r--r--tests/ui/suggestions/issue-84973-negative.stderr10
-rw-r--r--tests/ui/suggestions/issue-84973.stderr10
-rw-r--r--tests/ui/suggestions/only-suggest-removal-of-conversion-method-calls.stderr9
-rw-r--r--tests/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.stderr20
-rw-r--r--tests/ui/suggestions/suggest-imm-mut-trait-implementations.stderr20
-rw-r--r--tests/ui/switched-expectations.stderr9
-rw-r--r--tests/ui/traits/negative-impls/negated-auto-traits-error.stderr10
-rw-r--r--tests/ui/typeck/conversion-methods.stderr30
24 files changed, 187 insertions, 110 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 5746c28a2ab..a128f8d31a1 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -1165,7 +1165,7 @@ impl<'a, G: EmissionGuarantee> Diag<'a, G> {
         self.push_suggestion(CodeSuggestion {
             substitutions,
             msg: self.subdiagnostic_message_to_diagnostic_message(msg),
-            style: SuggestionStyle::ShowCode,
+            style: SuggestionStyle::ShowAlways,
             applicability,
         });
         self
diff --git a/tests/ui/derives/deriving-copyclone.stderr b/tests/ui/derives/deriving-copyclone.stderr
index 707a63ba28d..befff880280 100644
--- a/tests/ui/derives/deriving-copyclone.stderr
+++ b/tests/ui/derives/deriving-copyclone.stderr
@@ -2,10 +2,8 @@ error[E0277]: the trait bound `B<C>: Copy` is not satisfied
   --> $DIR/deriving-copyclone.rs:31:26
    |
 LL |     is_copy(B { a: 1, b: C });
-   |     -------              ^
-   |     |                    |
-   |     |                    the trait `Copy` is not implemented for `B<C>`
-   |     |                    help: consider borrowing here: `&`
+   |     -------              ^ the trait `Copy` is not implemented for `B<C>`
+   |     |
    |     required by a bound introduced by this call
    |
 note: required for `B<C>` to implement `Copy`
@@ -18,15 +16,17 @@ note: required by a bound in `is_copy`
    |
 LL | fn is_copy<T: Copy>(_: T) {}
    |               ^^^^ required by this bound in `is_copy`
+help: consider borrowing here
+   |
+LL |     is_copy(B { a: 1, b: &C });
+   |                          +
 
 error[E0277]: the trait bound `B<C>: Clone` is not satisfied
   --> $DIR/deriving-copyclone.rs:32:27
    |
 LL |     is_clone(B { a: 1, b: C });
-   |     --------              ^
-   |     |                     |
-   |     |                     the trait `Clone` is not implemented for `B<C>`
-   |     |                     help: consider borrowing here: `&`
+   |     --------              ^ the trait `Clone` is not implemented for `B<C>`
+   |     |
    |     required by a bound introduced by this call
    |
 note: required for `B<C>` to implement `Clone`
@@ -39,15 +39,17 @@ note: required by a bound in `is_clone`
    |
 LL | fn is_clone<T: Clone>(_: T) {}
    |                ^^^^^ required by this bound in `is_clone`
+help: consider borrowing here
+   |
+LL |     is_clone(B { a: 1, b: &C });
+   |                           +
 
 error[E0277]: the trait bound `B<D>: Copy` is not satisfied
   --> $DIR/deriving-copyclone.rs:35:26
    |
 LL |     is_copy(B { a: 1, b: D });
-   |     -------              ^
-   |     |                    |
-   |     |                    the trait `Copy` is not implemented for `B<D>`
-   |     |                    help: consider borrowing here: `&`
+   |     -------              ^ the trait `Copy` is not implemented for `B<D>`
+   |     |
    |     required by a bound introduced by this call
    |
 note: required for `B<D>` to implement `Copy`
@@ -60,6 +62,10 @@ note: required by a bound in `is_copy`
    |
 LL | fn is_copy<T: Copy>(_: T) {}
    |               ^^^^ required by this bound in `is_copy`
+help: consider borrowing here
+   |
+LL |     is_copy(B { a: 1, b: &D });
+   |                          +
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/for/issue-20605.current.stderr b/tests/ui/for/issue-20605.current.stderr
index 289dca289ae..1a66cb41464 100644
--- a/tests/ui/for/issue-20605.current.stderr
+++ b/tests/ui/for/issue-20605.current.stderr
@@ -2,13 +2,14 @@ error[E0277]: `dyn Iterator<Item = &'a mut u8>` is not an iterator
   --> $DIR/issue-20605.rs:6:17
    |
 LL |     for item in *things { *item = 0 }
-   |                 -^^^^^^
-   |                 |
-   |                 the trait `IntoIterator` is not implemented for `dyn Iterator<Item = &'a mut u8>`
-   |                 help: consider mutably borrowing here: `&mut`
+   |                 ^^^^^^^ the trait `IntoIterator` is not implemented for `dyn Iterator<Item = &'a mut u8>`
    |
    = note: the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied
    = note: required for `dyn Iterator<Item = &'a mut u8>` to implement `IntoIterator`
+help: consider mutably borrowing here
+   |
+LL |     for item in &mut *things { *item = 0 }
+   |                 ++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/for/issue-20605.next.stderr b/tests/ui/for/issue-20605.next.stderr
index 289dca289ae..1a66cb41464 100644
--- a/tests/ui/for/issue-20605.next.stderr
+++ b/tests/ui/for/issue-20605.next.stderr
@@ -2,13 +2,14 @@ error[E0277]: `dyn Iterator<Item = &'a mut u8>` is not an iterator
   --> $DIR/issue-20605.rs:6:17
    |
 LL |     for item in *things { *item = 0 }
-   |                 -^^^^^^
-   |                 |
-   |                 the trait `IntoIterator` is not implemented for `dyn Iterator<Item = &'a mut u8>`
-   |                 help: consider mutably borrowing here: `&mut`
+   |                 ^^^^^^^ the trait `IntoIterator` is not implemented for `dyn Iterator<Item = &'a mut u8>`
    |
    = note: the trait bound `dyn Iterator<Item = &'a mut u8>: IntoIterator` is not satisfied
    = note: required for `dyn Iterator<Item = &'a mut u8>` to implement `IntoIterator`
+help: consider mutably borrowing here
+   |
+LL |     for item in &mut *things { *item = 0 }
+   |                 ++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
index 856c92217b9..4c429624e0b 100644
--- a/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
+++ b/tests/ui/impl-trait/in-trait/default-body-type-err-2.stderr
@@ -4,9 +4,12 @@ error[E0308]: mismatched types
 LL |     async fn woopsie_async(&self) -> String {
    |                                      ------ expected `String` because of return type
 LL |         42
-   |         ^^- help: try using a conversion method: `.to_string()`
-   |         |
-   |         expected `String`, found integer
+   |         ^^ expected `String`, found integer
+   |
+help: try using a conversion method
+   |
+LL |         42.to_string()
+   |           ++++++++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/inference/deref-suggestion.stderr b/tests/ui/inference/deref-suggestion.stderr
index 8ccd28198af..027902a9f31 100644
--- a/tests/ui/inference/deref-suggestion.stderr
+++ b/tests/ui/inference/deref-suggestion.stderr
@@ -2,9 +2,8 @@ error[E0308]: mismatched types
   --> $DIR/deref-suggestion.rs:8:9
    |
 LL |     foo(s);
-   |     --- ^- help: try using a conversion method: `.to_string()`
-   |     |   |
-   |     |   expected `String`, found `&String`
+   |     --- ^ expected `String`, found `&String`
+   |     |
    |     arguments to this function are incorrect
    |
 note: function defined here
@@ -12,6 +11,10 @@ note: function defined here
    |
 LL | fn foo(_: String) {}
    |    ^^^ ---------
+help: try using a conversion method
+   |
+LL |     foo(s.to_string());
+   |          ++++++++++++
 
 error[E0308]: mismatched types
   --> $DIR/deref-suggestion.rs:14:10
diff --git a/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr b/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr
index ce2022374f7..9f31a731fed 100644
--- a/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr
+++ b/tests/ui/repeat-expr/typo-in-repeat-expr-issue-80173.stderr
@@ -38,9 +38,12 @@ error[E0308]: mismatched types
   --> $DIR/typo-in-repeat-expr-issue-80173.rs:32:29
    |
 LL |     let e = [String::new(), 10];
-   |                             ^^- help: try using a conversion method: `.to_string()`
-   |                             |
-   |                             expected `String`, found integer
+   |                             ^^ expected `String`, found integer
+   |
+help: try using a conversion method
+   |
+LL |     let e = [String::new(), 10.to_string()];
+   |                               ++++++++++++
 
 error[E0308]: mismatched types
   --> $DIR/typo-in-repeat-expr-issue-80173.rs:36:19
diff --git a/tests/ui/static/bad-const-type.stderr b/tests/ui/static/bad-const-type.stderr
index 807cd2f7a25..8573a11ef29 100644
--- a/tests/ui/static/bad-const-type.stderr
+++ b/tests/ui/static/bad-const-type.stderr
@@ -2,9 +2,12 @@ error[E0308]: mismatched types
   --> $DIR/bad-const-type.rs:1:20
    |
 LL | static i: String = 10;
-   |                    ^^- help: try using a conversion method: `.to_string()`
-   |                    |
-   |                    expected `String`, found integer
+   |                    ^^ expected `String`, found integer
+   |
+help: try using a conversion method
+   |
+LL | static i: String = 10.to_string();
+   |                      ++++++++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr
index 62f1c03e9aa..4b770d572c5 100644
--- a/tests/ui/suggestions/imm-ref-trait-object-literal.stderr
+++ b/tests/ui/suggestions/imm-ref-trait-object-literal.stderr
@@ -21,10 +21,8 @@ error[E0277]: the trait bound `S: Trait` is not satisfied
   --> $DIR/imm-ref-trait-object-literal.rs:13:7
    |
 LL |   foo(s);
-   |   --- ^
-   |   |   |
-   |   |   the trait `Trait` is not implemented for `S`
-   |   |   help: consider mutably borrowing here: `&mut`
+   |   --- ^ the trait `Trait` is not implemented for `S`
+   |   |
    |   required by a bound introduced by this call
    |
 note: required by a bound in `foo`
@@ -32,6 +30,10 @@ note: required by a bound in `foo`
    |
 LL | fn foo<X: Trait>(_: X) {}
    |           ^^^^^ required by this bound in `foo`
+help: consider mutably borrowing here
+   |
+LL |   foo(&mut s);
+   |       ++++
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/suggestions/issue-104961.stderr b/tests/ui/suggestions/issue-104961.stderr
index 6f02c125cad..0d229e6dada 100644
--- a/tests/ui/suggestions/issue-104961.stderr
+++ b/tests/ui/suggestions/issue-104961.stderr
@@ -18,15 +18,17 @@ error[E0277]: the trait bound `String: Pattern` is not satisfied
   --> $DIR/issue-104961.rs:9:19
    |
 LL |     x.starts_with("hi".to_string())
-   |       ----------- -^^^^^^^^^^^^^^^
-   |       |           |
-   |       |           the trait `Pattern` is not implemented for `String`
-   |       |           help: consider borrowing here: `&`
+   |       ----------- ^^^^^^^^^^^^^^^^ the trait `Pattern` is not implemented for `String`
+   |       |
    |       required by a bound introduced by this call
    |
    = note: required for `String` to implement `Pattern`
 note: required by a bound in `core::str::<impl str>::starts_with`
   --> $SRC_DIR/core/src/str/mod.rs:LL:COL
+help: consider borrowing here
+   |
+LL |     x.starts_with(&"hi".to_string())
+   |                   +
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/suggestions/issue-52820.stderr b/tests/ui/suggestions/issue-52820.stderr
index a67d7501417..de2c9542f61 100644
--- a/tests/ui/suggestions/issue-52820.stderr
+++ b/tests/ui/suggestions/issue-52820.stderr
@@ -13,10 +13,13 @@ error[E0308]: mismatched types
   --> $DIR/issue-52820.rs:13:17
    |
 LL |         brains: guts.clone(),
-   |                 ^^^^^-----^^
-   |                 |    |
-   |                 |    help: try using a conversion method: `to_string`
-   |                 expected `String`, found `&str`
+   |                 ^^^^^^^^^^^^ expected `String`, found `&str`
+   |
+help: try using a conversion method
+   |
+LL -         brains: guts.clone(),
+LL +         brains: guts.to_string(),
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/suggestions/issue-53692.stderr b/tests/ui/suggestions/issue-53692.stderr
index 469a538411f..10ebb30a5b2 100644
--- a/tests/ui/suggestions/issue-53692.stderr
+++ b/tests/ui/suggestions/issue-53692.stderr
@@ -2,24 +2,31 @@ error[E0308]: mismatched types
   --> $DIR/issue-53692.rs:7:33
    |
 LL |     let items_clone: Vec<i32> = ref_items.clone();
-   |                      --------   ^^^^^^^^^^-----^^
-   |                      |          |         |
-   |                      |          |         help: try using a conversion method: `to_vec`
-   |                      |          expected `Vec<i32>`, found `&[i32]`
+   |                      --------   ^^^^^^^^^^^^^^^^^ expected `Vec<i32>`, found `&[i32]`
+   |                      |
    |                      expected due to this
    |
    = note: expected struct `Vec<i32>`
            found reference `&[i32]`
+help: try using a conversion method
+   |
+LL -     let items_clone: Vec<i32> = ref_items.clone();
+LL +     let items_clone: Vec<i32> = ref_items.to_vec();
+   |
 
 error[E0308]: mismatched types
   --> $DIR/issue-53692.rs:14:26
    |
 LL |     let string: String = s.clone();
-   |                 ------   ^^-----^^
-   |                 |        | |
-   |                 |        | help: try using a conversion method: `to_string`
-   |                 |        expected `String`, found `&str`
+   |                 ------   ^^^^^^^^^ expected `String`, found `&str`
+   |                 |
    |                 expected due to this
+   |
+help: try using a conversion method
+   |
+LL -     let string: String = s.clone();
+LL +     let string: String = s.to_string();
+   |
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/suggestions/issue-59819.stderr b/tests/ui/suggestions/issue-59819.stderr
index 43acf9549c2..ab91961192f 100644
--- a/tests/ui/suggestions/issue-59819.stderr
+++ b/tests/ui/suggestions/issue-59819.stderr
@@ -28,10 +28,14 @@ error[E0308]: mismatched types
   --> $DIR/issue-59819.rs:34:21
    |
 LL |     let g: String = f;
-   |            ------   ^- help: try using a conversion method: `.to_string()`
-   |            |        |
-   |            |        expected `String`, found `Bar`
+   |            ------   ^ expected `String`, found `Bar`
+   |            |
    |            expected due to this
+   |
+help: try using a conversion method
+   |
+LL |     let g: String = f.to_string();
+   |                      ++++++++++++
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/suggestions/issue-62843.stderr b/tests/ui/suggestions/issue-62843.stderr
index c3480a8e396..c3c0360b3a9 100644
--- a/tests/ui/suggestions/issue-62843.stderr
+++ b/tests/ui/suggestions/issue-62843.stderr
@@ -2,15 +2,17 @@ error[E0277]: the trait bound `String: Pattern` is not satisfied
   --> $DIR/issue-62843.rs:4:32
    |
 LL |     println!("{:?}", line.find(pattern));
-   |                           ---- -^^^^^^
-   |                           |    |
-   |                           |    the trait `Pattern` is not implemented for `String`
-   |                           |    help: consider borrowing here: `&`
+   |                           ---- ^^^^^^^ the trait `Pattern` is not implemented for `String`
+   |                           |
    |                           required by a bound introduced by this call
    |
    = note: required for `String` to implement `Pattern`
 note: required by a bound in `core::str::<impl str>::find`
   --> $SRC_DIR/core/src/str/mod.rs:LL:COL
+help: consider borrowing here
+   |
+LL |     println!("{:?}", line.find(&pattern));
+   |                                +
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/suggestions/issue-83943.stderr b/tests/ui/suggestions/issue-83943.stderr
index 1a085368485..e714a126f4a 100644
--- a/tests/ui/suggestions/issue-83943.stderr
+++ b/tests/ui/suggestions/issue-83943.stderr
@@ -6,11 +6,14 @@ LL | |         "A".to_string()
    | |         --------------- expected because of this
 LL | |     } else {
 LL | |         "B"
-   | |         ^^^- help: try using a conversion method: `.to_string()`
-   | |         |
-   | |         expected `String`, found `&str`
+   | |         ^^^ expected `String`, found `&str`
 LL | |     };
    | |_____- `if` and `else` have incompatible types
+   |
+help: try using a conversion method
+   |
+LL |         "B".to_string()
+   |            ++++++++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/suggestions/issue-84973-2.stderr b/tests/ui/suggestions/issue-84973-2.stderr
index 914307008ef..74995a0500a 100644
--- a/tests/ui/suggestions/issue-84973-2.stderr
+++ b/tests/ui/suggestions/issue-84973-2.stderr
@@ -2,10 +2,8 @@ error[E0277]: the trait bound `i32: Tr` is not satisfied
   --> $DIR/issue-84973-2.rs:11:9
    |
 LL |     foo(a);
-   |     --- ^
-   |     |   |
-   |     |   the trait `Tr` is not implemented for `i32`
-   |     |   help: consider mutably borrowing here: `&mut`
+   |     --- ^ the trait `Tr` is not implemented for `i32`
+   |     |
    |     required by a bound introduced by this call
    |
 note: required by a bound in `foo`
@@ -13,6 +11,10 @@ note: required by a bound in `foo`
    |
 LL | fn foo<T: Tr>(i: T) {}
    |           ^^ required by this bound in `foo`
+help: consider mutably borrowing here
+   |
+LL |     foo(&mut a);
+   |         ++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/suggestions/issue-84973-negative.stderr b/tests/ui/suggestions/issue-84973-negative.stderr
index e3e6296890f..ce838bce09e 100644
--- a/tests/ui/suggestions/issue-84973-negative.stderr
+++ b/tests/ui/suggestions/issue-84973-negative.stderr
@@ -17,10 +17,8 @@ error[E0277]: the trait bound `f32: Tr` is not satisfied
   --> $DIR/issue-84973-negative.rs:11:9
    |
 LL |     bar(b);
-   |     --- ^
-   |     |   |
-   |     |   the trait `Tr` is not implemented for `f32`
-   |     |   help: consider borrowing here: `&`
+   |     --- ^ the trait `Tr` is not implemented for `f32`
+   |     |
    |     required by a bound introduced by this call
    |
 note: required by a bound in `bar`
@@ -28,6 +26,10 @@ note: required by a bound in `bar`
    |
 LL | fn bar<T: Tr>(t: T) {}
    |           ^^ required by this bound in `bar`
+help: consider borrowing here
+   |
+LL |     bar(&b);
+   |         +
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/suggestions/issue-84973.stderr b/tests/ui/suggestions/issue-84973.stderr
index 5ca91c544db..c5e1958e030 100644
--- a/tests/ui/suggestions/issue-84973.stderr
+++ b/tests/ui/suggestions/issue-84973.stderr
@@ -2,10 +2,8 @@ error[E0277]: the trait bound `Fancy: SomeTrait` is not satisfied
   --> $DIR/issue-84973.rs:6:24
    |
 LL |     let o = Other::new(f);
-   |             ---------- ^
-   |             |          |
-   |             |          the trait `SomeTrait` is not implemented for `Fancy`
-   |             |          help: consider borrowing here: `&`
+   |             ---------- ^ the trait `SomeTrait` is not implemented for `Fancy`
+   |             |
    |             required by a bound introduced by this call
    |
 note: required by a bound in `Other::<'a, G>::new`
@@ -16,6 +14,10 @@ LL |     G: SomeTrait,
 LL | {
 LL |     pub fn new(g: G) -> Self {
    |            --- required by a bound in this associated function
+help: consider borrowing here
+   |
+LL |     let o = Other::new(&f);
+   |                        +
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/suggestions/only-suggest-removal-of-conversion-method-calls.stderr b/tests/ui/suggestions/only-suggest-removal-of-conversion-method-calls.stderr
index c721ceb1146..ed94ebd27ff 100644
--- a/tests/ui/suggestions/only-suggest-removal-of-conversion-method-calls.stderr
+++ b/tests/ui/suggestions/only-suggest-removal-of-conversion-method-calls.stderr
@@ -5,9 +5,12 @@ LL | fn get_name() -> String {
    |                  ------ expected `String` because of return type
 ...
 LL |     your_name.trim()
-   |     ^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
-   |     |
-   |     expected `String`, found `&str`
+   |     ^^^^^^^^^^^^^^^^ expected `String`, found `&str`
+   |
+help: try using a conversion method
+   |
+LL |     your_name.trim().to_string()
+   |                     ++++++++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.stderr b/tests/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.stderr
index 146d6705243..485015a98f2 100644
--- a/tests/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.stderr
+++ b/tests/ui/suggestions/suggest-adding-reference-to-trait-assoc-item.stderr
@@ -2,19 +2,23 @@ error[E0277]: the trait bound `&mut usize: Default` is not satisfied
   --> $DIR/suggest-adding-reference-to-trait-assoc-item.rs:13:9
    |
 LL |     foo(Default::default());
-   |         -^^^^^^^^^^^^^^^^^
-   |         |
-   |         the trait `Default` is not implemented for `&mut usize`
-   |         help: consider mutably borrowing here: `&mut`
+   |         ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `&mut usize`
+   |
+help: consider mutably borrowing here
+   |
+LL |     foo(&mut Default::default());
+   |         ++++
 
 error[E0277]: the trait bound `&usize: Default` is not satisfied
   --> $DIR/suggest-adding-reference-to-trait-assoc-item.rs:14:9
    |
 LL |     bar(Default::default());
-   |         -^^^^^^^^^^^^^^^^^
-   |         |
-   |         the trait `Default` is not implemented for `&usize`
-   |         help: consider borrowing here: `&`
+   |         ^^^^^^^^^^^^^^^^^^ the trait `Default` is not implemented for `&usize`
+   |
+help: consider borrowing here
+   |
+LL |     bar(&Default::default());
+   |         +
 
 error: aborting due to 2 previous errors
 
diff --git a/tests/ui/suggestions/suggest-imm-mut-trait-implementations.stderr b/tests/ui/suggestions/suggest-imm-mut-trait-implementations.stderr
index b3a0c68450e..f2eb651eaa4 100644
--- a/tests/ui/suggestions/suggest-imm-mut-trait-implementations.stderr
+++ b/tests/ui/suggestions/suggest-imm-mut-trait-implementations.stderr
@@ -22,10 +22,8 @@ error[E0277]: the trait bound `B: Trait` is not satisfied
   --> $DIR/suggest-imm-mut-trait-implementations.rs:21:9
    |
 LL |     foo(b);
-   |     --- ^
-   |     |   |
-   |     |   the trait `Trait` is not implemented for `B`
-   |     |   help: consider borrowing here: `&`
+   |     --- ^ the trait `Trait` is not implemented for `B`
+   |     |
    |     required by a bound introduced by this call
    |
 note: required by a bound in `foo`
@@ -33,15 +31,17 @@ note: required by a bound in `foo`
    |
 LL | fn foo<X: Trait>(_: X) {}
    |           ^^^^^ required by this bound in `foo`
+help: consider borrowing here
+   |
+LL |     foo(&b);
+   |         +
 
 error[E0277]: the trait bound `C: Trait` is not satisfied
   --> $DIR/suggest-imm-mut-trait-implementations.rs:22:9
    |
 LL |     foo(c);
-   |     --- ^
-   |     |   |
-   |     |   the trait `Trait` is not implemented for `C`
-   |     |   help: consider mutably borrowing here: `&mut`
+   |     --- ^ the trait `Trait` is not implemented for `C`
+   |     |
    |     required by a bound introduced by this call
    |
 note: required by a bound in `foo`
@@ -49,6 +49,10 @@ note: required by a bound in `foo`
    |
 LL | fn foo<X: Trait>(_: X) {}
    |           ^^^^^ required by this bound in `foo`
+help: consider mutably borrowing here
+   |
+LL |     foo(&mut c);
+   |         ++++
 
 error: aborting due to 3 previous errors
 
diff --git a/tests/ui/switched-expectations.stderr b/tests/ui/switched-expectations.stderr
index cc576747400..e235c2da1f7 100644
--- a/tests/ui/switched-expectations.stderr
+++ b/tests/ui/switched-expectations.stderr
@@ -2,9 +2,12 @@ error[E0308]: mismatched types
   --> $DIR/switched-expectations.rs:3:30
    |
 LL |     let ref string: String = var;
-   |                              ^^^- help: try using a conversion method: `.to_string()`
-   |                              |
-   |                              expected `String`, found `i32`
+   |                              ^^^ expected `String`, found `i32`
+   |
+help: try using a conversion method
+   |
+LL |     let ref string: String = var.to_string();
+   |                                 ++++++++++++
 
 error: aborting due to 1 previous error
 
diff --git a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr
index cc5ca471788..8f5b937e586 100644
--- a/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr
+++ b/tests/ui/traits/negative-impls/negated-auto-traits-error.stderr
@@ -61,10 +61,8 @@ error[E0277]: `dummy2::TestType` cannot be sent between threads safely
   --> $DIR/negated-auto-traits-error.rs:48:13
    |
 LL |     is_send(Box::new(TestType));
-   |     ------- -^^^^^^^^^^^^^^^^^
-   |     |       |
-   |     |       the trait `Send` is not implemented for `Unique<dummy2::TestType>`
-   |     |       help: consider borrowing here: `&`
+   |     ------- ^^^^^^^^^^^^^^^^^^ the trait `Send` is not implemented for `Unique<dummy2::TestType>`
+   |     |
    |     required by a bound introduced by this call
    |
    = note: the trait bound `Unique<dummy2::TestType>: Send` is not satisfied
@@ -76,6 +74,10 @@ note: required by a bound in `is_send`
    |
 LL | fn is_send<T: Send>(_: T) {}
    |               ^^^^ required by this bound in `is_send`
+help: consider borrowing here
+   |
+LL |     is_send(&Box::new(TestType));
+   |             +
 
 error[E0277]: `dummy3::TestType` cannot be sent between threads safely
   --> $DIR/negated-auto-traits-error.rs:56:13
diff --git a/tests/ui/typeck/conversion-methods.stderr b/tests/ui/typeck/conversion-methods.stderr
index a9b5078ccdd..fa8928f1454 100644
--- a/tests/ui/typeck/conversion-methods.stderr
+++ b/tests/ui/typeck/conversion-methods.stderr
@@ -2,28 +2,40 @@ error[E0308]: mismatched types
   --> $DIR/conversion-methods.rs:5:41
    |
 LL |     let _tis_an_instants_play: String = "'Tis a fond Ambush—";
-   |                                ------   ^^^^^^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
-   |                                |        |
-   |                                |        expected `String`, found `&str`
+   |                                ------   ^^^^^^^^^^^^^^^^^^^^^ expected `String`, found `&str`
+   |                                |
    |                                expected due to this
+   |
+help: try using a conversion method
+   |
+LL |     let _tis_an_instants_play: String = "'Tis a fond Ambush—".to_string();
+   |                                                              ++++++++++++
 
 error[E0308]: mismatched types
   --> $DIR/conversion-methods.rs:6:40
    |
 LL |     let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise");
-   |                              -------   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_path_buf()`
-   |                              |         |
-   |                              |         expected `PathBuf`, found `&Path`
+   |                              -------   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `PathBuf`, found `&Path`
+   |                              |
    |                              expected due to this
+   |
+help: try using a conversion method
+   |
+LL |     let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise").to_path_buf();
+   |                                                                          ++++++++++++++
 
 error[E0308]: mismatched types
   --> $DIR/conversion-methods.rs:9:40
    |
 LL |     let _but_should_the_play: String = 2; // Perhaps surprisingly, we suggest .to_string() here
-   |                               ------   ^- help: try using a conversion method: `.to_string()`
-   |                               |        |
-   |                               |        expected `String`, found integer
+   |                               ------   ^ expected `String`, found integer
+   |                               |
    |                               expected due to this
+   |
+help: try using a conversion method
+   |
+LL |     let _but_should_the_play: String = 2.to_string(); // Perhaps surprisingly, we suggest .to_string() here
+   |                                         ++++++++++++
 
 error[E0308]: mismatched types
   --> $DIR/conversion-methods.rs:12:47