File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
src/tools/miri/tests/pass Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,21 @@ async fn hello_world() {
58
58
read_exact ( & mut reader, & mut marker) . await . unwrap ( ) ;
59
59
}
60
60
61
+ // This example comes from https://github.com/rust-lang/rust/issues/115145
62
+ async fn uninhabited_variant ( ) {
63
+ async fn unreachable ( _: Never ) { }
64
+
65
+ let c = async { } ;
66
+ match None :: < Never > {
67
+ None => {
68
+ c. await ;
69
+ }
70
+ Some ( r) => {
71
+ unreachable ( r) . await ;
72
+ }
73
+ }
74
+ }
75
+
61
76
fn run_fut < T > ( fut : impl Future < Output = T > ) -> T {
62
77
use std:: task:: { Context , Poll , Waker } ;
63
78
@@ -80,4 +95,5 @@ fn main() {
80
95
assert_eq ! ( run_fut( includes_never( false , 4 ) ) , 16 ) ;
81
96
assert_eq ! ( run_fut( partial_init( 4 ) ) , 8 ) ;
82
97
run_fut ( hello_world ( ) ) ;
98
+ run_fut ( uninhabited_variant ( ) ) ;
83
99
}
You can’t perform that action at this time.
0 commit comments