Account for possible boxable impl Future in semicolon removal suggestions
This commit is contained in:
parent
a4ee3ca1e4
commit
671d7c4afb
7 changed files with 152 additions and 32 deletions
|
|
@ -14,6 +14,7 @@ fn extra_semicolon() {
|
|||
}
|
||||
|
||||
async fn async_dummy() {} //~ NOTE the `Output` of this `async fn`'s found opaque type
|
||||
async fn async_dummy2() {} //~ NOTE the `Output` of this `async fn`'s found opaque type
|
||||
|
||||
async fn async_extra_semicolon_same() {
|
||||
let _ = match true { //~ NOTE `match` arms have incompatible types
|
||||
|
|
@ -28,5 +29,17 @@ async fn async_extra_semicolon_same() {
|
|||
};
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
async fn async_extra_semicolon_different() {
|
||||
let _ = match true { //~ NOTE `match` arms have incompatible types
|
||||
true => {
|
||||
async_dummy(); //~ NOTE this is found to be
|
||||
//~^ HELP consider removing this semicolon
|
||||
}
|
||||
false => async_dummy2(), //~ ERROR `match` arms have incompatible types
|
||||
//~^ NOTE expected `()`, found opaque type
|
||||
//~| NOTE expected type `()`
|
||||
//~| HELP consider `await`ing on the `Future`
|
||||
};
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0308]: `match` arms have incompatible types
|
||||
--> $DIR/match-prev-arm-needing-semi.rs:24:18
|
||||
--> $DIR/match-prev-arm-needing-semi.rs:25:18
|
||||
|
|
||||
LL | async fn async_dummy() {}
|
||||
| - the `Output` of this `async fn`'s found opaque type
|
||||
|
|
@ -20,7 +20,7 @@ LL | | };
|
|||
|
|
||||
= note: expected type `()`
|
||||
found opaque type `impl Future`
|
||||
help: consider removing this semicolon
|
||||
help: consider removing this semicolon and boxing the expression
|
||||
|
|
||||
LL | async_dummy()
|
||||
| --
|
||||
|
|
@ -29,6 +29,37 @@ help: consider `await`ing on the `Future`
|
|||
LL | false => async_dummy().await,
|
||||
| ^^^^^^
|
||||
|
||||
error[E0308]: `match` arms have incompatible types
|
||||
--> $DIR/match-prev-arm-needing-semi.rs:38:18
|
||||
|
|
||||
LL | async fn async_dummy2() {}
|
||||
| - the `Output` of this `async fn`'s found opaque type
|
||||
...
|
||||
LL | let _ = match true {
|
||||
| _____________-
|
||||
LL | | true => {
|
||||
LL | | async_dummy();
|
||||
| | -------------- this is found to be of type `()`
|
||||
LL | |
|
||||
LL | | }
|
||||
LL | | false => async_dummy2(),
|
||||
| | ^^^^^^^^^^^^^^ expected `()`, found opaque type
|
||||
... |
|
||||
LL | |
|
||||
LL | | };
|
||||
| |_____- `match` arms have incompatible types
|
||||
|
|
||||
= note: expected type `()`
|
||||
found opaque type `impl Future`
|
||||
help: consider removing this semicolon and boxing the expression
|
||||
|
|
||||
LL | async_dummy()
|
||||
| --
|
||||
help: consider `await`ing on the `Future`
|
||||
|
|
||||
LL | false => async_dummy2().await,
|
||||
| ^^^^^^
|
||||
|
||||
error[E0308]: `match` arms have incompatible types
|
||||
--> $DIR/match-prev-arm-needing-semi.rs:11:18
|
||||
|
|
||||
|
|
@ -48,6 +79,6 @@ LL | |
|
|||
LL | | };
|
||||
| |_____- `match` arms have incompatible types
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0308`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue