about summary refs log tree commit diff
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2022-05-24 09:57:14 +0200
committerlcnr <rust@lcnr.de>2022-06-02 10:19:15 +0200
commitbc0d12cc6ccf5c6d8d9c44e67871a5b75f5a44cf (patch)
treef1d421f2791ec6836744b1ed2c34ebdb3a964faa
parent3fe346e7a3776d01541fc973c4a7bb686ef3b1a8 (diff)
downloadrust-bc0d12cc6ccf5c6d8d9c44e67871a5b75f5a44cf.tar.gz
rust-bc0d12cc6ccf5c6d8d9c44e67871a5b75f5a44cf.zip
use verbose suggestions
-rw-r--r--compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs4
-rw-r--r--src/test/ui/inference/cannot-infer-partial-try-return.stderr9
-rw-r--r--src/test/ui/suggestions/suggest-closure-return-type-1.stderr9
-rw-r--r--src/test/ui/suggestions/suggest-closure-return-type-2.stderr7
-rw-r--r--src/test/ui/type-inference/or_else-multiple-type-params.stderr7
5 files changed, 26 insertions, 10 deletions
diff --git a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
index 779735ed444..b0b7fc6ad5a 100644
--- a/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
+++ b/compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs
@@ -422,7 +422,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
                     (receiver.span.shrink_to_lo(), format!("{def_path}({adjustment}")),
                     (receiver.span.shrink_to_hi().with_hi(successor.1), successor.0.to_string()),
                 ];
-                err.multipart_suggestion(
+                err.multipart_suggestion_verbose(
                     "try using a fully qualified path to specify the expected types",
                     suggestion,
                     Applicability::HasPlaceholders,
@@ -441,7 +441,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
                     ],
                     None => vec![(data.span(), format!("{}{}{}", arrow, ret, post))],
                 };
-                err.multipart_suggestion(
+                err.multipart_suggestion_verbose(
                     "try giving this closure an explicit return type",
                     suggestion,
                     Applicability::HasPlaceholders,
diff --git a/src/test/ui/inference/cannot-infer-partial-try-return.stderr b/src/test/ui/inference/cannot-infer-partial-try-return.stderr
index 3956b1a18de..220602c124c 100644
--- a/src/test/ui/inference/cannot-infer-partial-try-return.stderr
+++ b/src/test/ui/inference/cannot-infer-partial-try-return.stderr
@@ -2,9 +2,12 @@ error[E0282]: type annotations needed for `Result<(), QualifiedError<_>>`
   --> $DIR/cannot-infer-partial-try-return.rs:18:13
    |
 LL |     let x = || -> Result<_, QualifiedError<_>> {
-   |             ^^^^^^----------------------------
-   |                   |
-   |                   help: try giving this closure an explicit return type: `Result<(), QualifiedError<_>>`
+   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+help: try giving this closure an explicit return type
+   |
+LL |     let x = || -> Result<(), QualifiedError<_>> {
+   |                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/suggestions/suggest-closure-return-type-1.stderr b/src/test/ui/suggestions/suggest-closure-return-type-1.stderr
index ba70bf104bf..3116211b52c 100644
--- a/src/test/ui/suggestions/suggest-closure-return-type-1.stderr
+++ b/src/test/ui/suggestions/suggest-closure-return-type-1.stderr
@@ -2,9 +2,12 @@ error[E0282]: type annotations needed for `[_; 0]`
   --> $DIR/suggest-closure-return-type-1.rs:4:18
    |
 LL |     unbound_drop(|| -> _ { [] });
-   |                  ^^^^^^-
-   |                        |
-   |                        help: try giving this closure an explicit return type: `[_; 0]`
+   |                  ^^^^^^^
+   |
+help: try giving this closure an explicit return type
+   |
+LL |     unbound_drop(|| -> [_; 0] { [] });
+   |                        ~~~~~~
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/suggestions/suggest-closure-return-type-2.stderr b/src/test/ui/suggestions/suggest-closure-return-type-2.stderr
index f2cb6d291b3..f368e7de467 100644
--- a/src/test/ui/suggestions/suggest-closure-return-type-2.stderr
+++ b/src/test/ui/suggestions/suggest-closure-return-type-2.stderr
@@ -2,7 +2,12 @@ error[E0282]: type annotations needed for `[_; 0]`
   --> $DIR/suggest-closure-return-type-2.rs:4:18
    |
 LL |     unbound_drop(|| { [] })
-   |                  ^^ - help: try giving this closure an explicit return type: `-> [_; 0]`
+   |                  ^^
+   |
+help: try giving this closure an explicit return type
+   |
+LL |     unbound_drop(|| -> [_; 0] { [] })
+   |                     +++++++++
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/type-inference/or_else-multiple-type-params.stderr b/src/test/ui/type-inference/or_else-multiple-type-params.stderr
index 222638068ad..6ac63a91ee9 100644
--- a/src/test/ui/type-inference/or_else-multiple-type-params.stderr
+++ b/src/test/ui/type-inference/or_else-multiple-type-params.stderr
@@ -2,7 +2,12 @@ error[E0282]: type annotations needed for `Result<Child, F>`
   --> $DIR/or_else-multiple-type-params.rs:7:18
    |
 LL |         .or_else(|err| {
-   |                  ^^^^^ - help: try giving this closure an explicit return type: `-> Result<Child, F>`
+   |                  ^^^^^
+   |
+help: try giving this closure an explicit return type
+   |
+LL |         .or_else(|err| -> Result<Child, F> {
+   |                        +++++++++++++++++++
 
 error: aborting due to previous error