File tree Expand file tree Collapse file tree 3 files changed +34
-0
lines changed
tests/ui/rfcs/rfc-0000-never_patterns Expand file tree Collapse file tree 3 files changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ // edition: 2018
2+ // known-bug: #120240
3+ #![ feature( never_patterns) ]
4+ #![ allow( incomplete_features) ]
5+
6+ fn main ( ) { }
7+
8+ enum Void { }
9+
10+ // Divergence is not detected.
11+ async fn async_never ( !: Void ) -> ! { } // gives an error
12+
13+ // Divergence is detected
14+ async fn async_let ( x : Void ) -> ! {
15+ let ! = x;
16+ }
Original file line number Diff line number Diff line change 1+ error[E0308]: mismatched types
2+ --> $DIR/120240-async-fn-never-arg.rs:11:36
3+ |
4+ LL | async fn async_never(!: Void) -> ! {} // gives an error
5+ | ^^ expected `!`, found `()`
6+ |
7+ = note: expected type `!`
8+ found unit type `()`
9+
10+ error: aborting due to 1 previous error
11+
12+ For more information about this error, try `rustc --explain E0308`.
Original file line number Diff line number Diff line change 11// check-pass
2+ // edition: 2018
23#![ feature( never_patterns) ]
34#![ allow( incomplete_features) ]
45#![ deny( unreachable_patterns) ]
@@ -30,3 +31,8 @@ fn never_match() -> ! {
3031 // Ensures this typechecks because of divergence and not the type of the match expression.
3132 println ! ( ) ;
3233}
34+
35+ // Note: divergence is not detected for async fns when the `!` is in the argument (#120240).
36+ async fn async_let ( x : Void ) -> ! {
37+ let ! = x;
38+ }
You can’t perform that action at this time.
0 commit comments