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() {
5858 read_exact ( & mut reader, & mut marker) . await . unwrap ( ) ;
5959}
6060
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+
6176fn run_fut < T > ( fut : impl Future < Output = T > ) -> T {
6277 use std:: task:: { Context , Poll , Waker } ;
6378
@@ -80,4 +95,5 @@ fn main() {
8095 assert_eq ! ( run_fut( includes_never( false , 4 ) ) , 16 ) ;
8196 assert_eq ! ( run_fut( partial_init( 4 ) ) , 8 ) ;
8297 run_fut ( hello_world ( ) ) ;
98+ run_fut ( uninhabited_variant ( ) ) ;
8399}
You can’t perform that action at this time.
0 commit comments