use verbose suggestions
This commit is contained in:
parent
3fe346e7a3
commit
bc0d12cc6c
5 changed files with 26 additions and 10 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue