Add test case for different impl Future
s
This commit is contained in:
parent
3a0227bc49
commit
1829b4a887
2 changed files with 36 additions and 3 deletions
|
@ -15,6 +15,7 @@ fn extra_semicolon() {
|
||||||
|
|
||||||
async fn async_dummy() {} //~ NOTE the `Output` of this `async fn`'s found opaque type
|
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_dummy2() {} //~ NOTE the `Output` of this `async fn`'s found opaque type
|
||||||
|
//~^ NOTE the `Output` of this `async fn`'s found opaque type
|
||||||
|
|
||||||
async fn async_extra_semicolon_same() {
|
async fn async_extra_semicolon_same() {
|
||||||
let _ = match true { //~ NOTE `match` arms have incompatible types
|
let _ = match true { //~ NOTE `match` arms have incompatible types
|
||||||
|
@ -42,4 +43,14 @@ async fn async_extra_semicolon_different() {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn async_different_futures() {
|
||||||
|
let _ = match true { //~ NOTE `match` arms have incompatible types
|
||||||
|
true => async_dummy(), //~ NOTE this is found to be
|
||||||
|
false => async_dummy2(), //~ ERROR `match` arms have incompatible types
|
||||||
|
//~^ NOTE expected opaque type, found a different opaque type
|
||||||
|
//~| NOTE expected type `impl Future`
|
||||||
|
//~| NOTE distinct uses of `impl Trait` result in different opaque types
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
error[E0308]: `match` arms have incompatible types
|
error[E0308]: `match` arms have incompatible types
|
||||||
--> $DIR/match-prev-arm-needing-semi.rs:25:18
|
--> $DIR/match-prev-arm-needing-semi.rs:26:18
|
||||||
|
|
|
|
||||||
LL | async fn async_dummy() {}
|
LL | async fn async_dummy() {}
|
||||||
| - the `Output` of this `async fn`'s found opaque type
|
| - the `Output` of this `async fn`'s found opaque type
|
||||||
|
@ -30,7 +30,7 @@ LL | false => async_dummy().await,
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
error[E0308]: `match` arms have incompatible types
|
error[E0308]: `match` arms have incompatible types
|
||||||
--> $DIR/match-prev-arm-needing-semi.rs:38:18
|
--> $DIR/match-prev-arm-needing-semi.rs:39:18
|
||||||
|
|
|
|
||||||
LL | async fn async_dummy2() {}
|
LL | async fn async_dummy2() {}
|
||||||
| - the `Output` of this `async fn`'s found opaque type
|
| - the `Output` of this `async fn`'s found opaque type
|
||||||
|
@ -60,6 +60,28 @@ help: consider `await`ing on the `Future`
|
||||||
LL | false => async_dummy2().await,
|
LL | false => async_dummy2().await,
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
||||||
|
error[E0308]: `match` arms have incompatible types
|
||||||
|
--> $DIR/match-prev-arm-needing-semi.rs:49:18
|
||||||
|
|
|
||||||
|
LL | async fn async_dummy2() {}
|
||||||
|
| - the `Output` of this `async fn`'s found opaque type
|
||||||
|
...
|
||||||
|
LL | let _ = match true {
|
||||||
|
| _____________-
|
||||||
|
LL | | true => async_dummy(),
|
||||||
|
| | ------------- this is found to be of type `impl Future`
|
||||||
|
LL | | false => async_dummy2(),
|
||||||
|
| | ^^^^^^^^^^^^^^ expected opaque type, found a different opaque type
|
||||||
|
LL | |
|
||||||
|
LL | |
|
||||||
|
LL | |
|
||||||
|
LL | | };
|
||||||
|
| |_____- `match` arms have incompatible types
|
||||||
|
|
|
||||||
|
= note: expected type `impl Future` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:16:24>)
|
||||||
|
found opaque type `impl Future` (opaque type at <$DIR/match-prev-arm-needing-semi.rs:17:25>)
|
||||||
|
= note: distinct uses of `impl Trait` result in different opaque types
|
||||||
|
|
||||||
error[E0308]: `match` arms have incompatible types
|
error[E0308]: `match` arms have incompatible types
|
||||||
--> $DIR/match-prev-arm-needing-semi.rs:11:18
|
--> $DIR/match-prev-arm-needing-semi.rs:11:18
|
||||||
|
|
|
|
||||||
|
@ -79,6 +101,6 @@ LL | |
|
||||||
LL | | };
|
LL | | };
|
||||||
| |_____- `match` arms have incompatible types
|
| |_____- `match` arms have incompatible types
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
For more information about this error, try `rustc --explain E0308`.
|
For more information about this error, try `rustc --explain E0308`.
|
||||||
|
|
Loading…
Add table
Reference in a new issue