Skip to content

Commit bc0d12c

Browse files
committed
use verbose suggestions
1 parent 3fe346e commit bc0d12c

File tree

5 files changed

+26
-10
lines changed

5 files changed

+26
-10
lines changed

compiler/rustc_infer/src/infer/error_reporting/need_type_info.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
422422
(receiver.span.shrink_to_lo(), format!("{def_path}({adjustment}")),
423423
(receiver.span.shrink_to_hi().with_hi(successor.1), successor.0.to_string()),
424424
];
425-
err.multipart_suggestion(
425+
err.multipart_suggestion_verbose(
426426
"try using a fully qualified path to specify the expected types",
427427
suggestion,
428428
Applicability::HasPlaceholders,
@@ -441,7 +441,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
441441
],
442442
None => vec![(data.span(), format!("{}{}{}", arrow, ret, post))],
443443
};
444-
err.multipart_suggestion(
444+
err.multipart_suggestion_verbose(
445445
"try giving this closure an explicit return type",
446446
suggestion,
447447
Applicability::HasPlaceholders,

src/test/ui/inference/cannot-infer-partial-try-return.stderr

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ error[E0282]: type annotations needed for `Result<(), QualifiedError<_>>`
22
--> $DIR/cannot-infer-partial-try-return.rs:18:13
33
|
44
LL | let x = || -> Result<_, QualifiedError<_>> {
5-
| ^^^^^^----------------------------
6-
| |
7-
| help: try giving this closure an explicit return type: `Result<(), QualifiedError<_>>`
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
help: try giving this closure an explicit return type
8+
|
9+
LL | let x = || -> Result<(), QualifiedError<_>> {
10+
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
811

912
error: aborting due to previous error
1013

src/test/ui/suggestions/suggest-closure-return-type-1.stderr

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ error[E0282]: type annotations needed for `[_; 0]`
22
--> $DIR/suggest-closure-return-type-1.rs:4:18
33
|
44
LL | unbound_drop(|| -> _ { [] });
5-
| ^^^^^^-
6-
| |
7-
| help: try giving this closure an explicit return type: `[_; 0]`
5+
| ^^^^^^^
6+
|
7+
help: try giving this closure an explicit return type
8+
|
9+
LL | unbound_drop(|| -> [_; 0] { [] });
10+
| ~~~~~~
811

912
error: aborting due to previous error
1013

src/test/ui/suggestions/suggest-closure-return-type-2.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ error[E0282]: type annotations needed for `[_; 0]`
22
--> $DIR/suggest-closure-return-type-2.rs:4:18
33
|
44
LL | unbound_drop(|| { [] })
5-
| ^^ - help: try giving this closure an explicit return type: `-> [_; 0]`
5+
| ^^
6+
|
7+
help: try giving this closure an explicit return type
8+
|
9+
LL | unbound_drop(|| -> [_; 0] { [] })
10+
| +++++++++
611

712
error: aborting due to previous error
813

src/test/ui/type-inference/or_else-multiple-type-params.stderr

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ error[E0282]: type annotations needed for `Result<Child, F>`
22
--> $DIR/or_else-multiple-type-params.rs:7:18
33
|
44
LL | .or_else(|err| {
5-
| ^^^^^ - help: try giving this closure an explicit return type: `-> Result<Child, F>`
5+
| ^^^^^
6+
|
7+
help: try giving this closure an explicit return type
8+
|
9+
LL | .or_else(|err| -> Result<Child, F> {
10+
| +++++++++++++++++++
611

712
error: aborting due to previous error
813

0 commit comments

Comments
 (0)