-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
tests/ui/rfcs/rfc-0000-never_patterns/120240-async-fn-never-arg.rs
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// edition: 2018 | ||
// known-bug: #120240 | ||
#![feature(never_patterns)] | ||
#![allow(incomplete_features)] | ||
|
||
fn main() {} | ||
|
||
enum Void {} | ||
|
||
// Divergence is not detected. | ||
async fn async_never(!: Void) -> ! {} // gives an error | ||
|
||
// Divergence is detected | ||
async fn async_let(x: Void) -> ! { | ||
let ! = x; | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/ui/rfcs/rfc-0000-never_patterns/120240-async-fn-never-arg.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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/120240-async-fn-never-arg.rs:11:36 | ||
| | ||
LL | async fn async_never(!: Void) -> ! {} // gives an error | ||
| ^^ expected `!`, found `()` | ||
| | ||
= note: expected type `!` | ||
found unit type `()` | ||
|
||
error: aborting due to 1 previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
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