Skip to content

Commit e615426

Browse files
committed
Auto merge of #3226 - saethlin:deadpool-test, r=RalfJung
Add a regression test for rust#115145 Per rust-lang/rust#118805 (comment)
2 parents dc217a0 + 226ef82 commit e615426

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

tests/pass/async-fn.rs

+16
Original file line numberDiff line numberDiff 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+
6176
fn 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
}

0 commit comments

Comments
 (0)