-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shorten error message for callable with wrong return type
``` error: expected `{closure@...}` to return `Ret`, but it returns `Other` ``` instead of ``` error: expected `{closure@...}` to be a closure that returns `Ret`, but it returns `Other` ```
- Loading branch information
Showing
23 changed files
with
29 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
error[E0271]: expected `{async [email protected]:8:14}` to be a closure that returns `()`, but it returns `{async closure body@$DIR/is-not-fn.rs:8:23: 8:25}` | ||
error[E0271]: expected `{async [email protected]:8:14}` to return `()`, but it returns `{async closure body@$DIR/is-not-fn.rs:8:23: 8:25}` | ||
--> $DIR/is-not-fn.rs:8:14 | ||
| | ||
LL | needs_fn(async || {}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
error[E0271]: expected `{async [email protected]:8:14}` to be a closure that returns `()`, but it returns `{async closure body@$DIR/is-not-fn.rs:8:23: 8:25}` | ||
error[E0271]: expected `{async [email protected]:8:14}` to return `()`, but it returns `{async closure body@$DIR/is-not-fn.rs:8:23: 8:25}` | ||
--> $DIR/is-not-fn.rs:8:14 | ||
| | ||
LL | needs_fn(async || {}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,5 +6,5 @@ | |
fn main() { | ||
fn needs_fn(x: impl FnOnce()) {} | ||
needs_fn(async || {}); | ||
//~^ ERROR expected `{async [email protected]:8:14}` to be a closure that returns `()` | ||
//~^ ERROR expected `{async [email protected]:8:14}` to return `()` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ LL | true | |
= note: expected enum `Option<()>` | ||
found type `bool` | ||
|
||
error[E0271]: expected `{[email protected]:6:10}` to be a closure that returns `bool`, but it returns `Option<()>` | ||
error[E0271]: expected `{[email protected]:6:10}` to return `bool`, but it returns `Option<()>` | ||
--> $DIR/dont-ice-for-type-mismatch-in-closure-in-async.rs:6:16 | ||
| | ||
LL | call(|| -> Option<()> { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
error[E0271]: expected `{[email protected]:8:17}` to be a closure that returns `Result<(), _>`, but it returns `!` | ||
error[E0271]: expected `{[email protected]:8:17}` to return `Result<(), _>`, but it returns `!` | ||
--> $DIR/return-type-doesnt-match-bound.rs:8:24 | ||
| | ||
LL | f().or_else(|e| -> ! { | ||
|
@@ -13,7 +13,7 @@ LL | f().or_else(|e| -> ! { | |
note: required by a bound in `Result::<T, E>::or_else` | ||
--> $SRC_DIR/core/src/result.rs:LL:COL | ||
|
||
error[E0271]: expected `{[email protected]:18:13}` to be a closure that returns `Result<(), _>`, but it returns `!` | ||
error[E0271]: expected `{[email protected]:18:13}` to return `Result<(), _>`, but it returns `!` | ||
--> $DIR/return-type-doesnt-match-bound.rs:18:20 | ||
| | ||
LL | let c = |e| -> ! { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ LL | where | |
LL | F: for<'r> T0<'r, (<Self as Ty<'r>>::V,), O = <B as Ty<'r>>::V>, | ||
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m` | ||
|
||
error[E0271]: expected `{[email protected]:40:16}` to be a closure that returns `Unit3`, but it returns `Unit4` | ||
error[E0271]: expected `{[email protected]:40:16}` to return `Unit3`, but it returns `Unit4` | ||
--> $DIR/issue-62203-hrtb-ice.rs:42:17 | ||
| | ||
LL | let v = Unit2.m( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
error[E0271]: expected `{[email protected]:18:40}` to be a closure that returns `()`, but it returns `!` | ||
error[E0271]: expected `{[email protected]:18:40}` to return `()`, but it returns `!` | ||
--> $DIR/fallback-closure-wrap.rs:19:9 | ||
| | ||
LL | let error = Closure::wrap(Box::new(move || { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,6 @@ fn bar<X>(x: Box<dyn FnOnce() -> X>) {} | |
|
||
fn main() { | ||
foo(async move || {}); | ||
//~^ ERROR expected `{async [email protected]:9:9}` to be a closure that returns `Box<_>` | ||
//~^ ERROR expected `{async [email protected]:9:9}` to return `Box<_>` | ||
bar(async move || {}); //~ ERROR mismatched types | ||
} |
2 changes: 1 addition & 1 deletion
2
tests/ui/suggestions/dont-suggest-boxing-async-closure-body.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
error[E0271]: expected `{async [email protected]:9:9}` to be a closure that returns `Box<_>`, but it returns `{async closure body@$DIR/dont-suggest-boxing-async-closure-body.rs:9:23: 9:25}` | ||
error[E0271]: expected `{async [email protected]:9:9}` to return `Box<_>`, but it returns `{async closure body@$DIR/dont-suggest-boxing-async-closure-body.rs:9:23: 9:25}` | ||
--> $DIR/dont-suggest-boxing-async-closure-body.rs:9:9 | ||
| | ||
LL | foo(async move || {}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters