From 226ef8265194d4fd61c31bd49da7df47a72dcc75 Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Thu, 14 Dec 2023 18:22:23 -0500 Subject: [PATCH] Add the test minimized from deadpool --- tests/pass/async-fn.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/pass/async-fn.rs b/tests/pass/async-fn.rs index 69f35afe86..6c92735df0 100644 --- a/tests/pass/async-fn.rs +++ b/tests/pass/async-fn.rs @@ -58,6 +58,21 @@ async fn hello_world() { read_exact(&mut reader, &mut marker).await.unwrap(); } +// This example comes from https://github.com/rust-lang/rust/issues/115145 +async fn uninhabited_variant() { + async fn unreachable(_: Never) {} + + let c = async {}; + match None:: { + None => { + c.await; + } + Some(r) => { + unreachable(r).await; + } + } +} + fn run_fut(fut: impl Future) -> T { use std::task::{Context, Poll, Waker}; @@ -80,4 +95,5 @@ fn main() { assert_eq!(run_fut(includes_never(false, 4)), 16); assert_eq!(run_fut(partial_init(4)), 8); run_fut(hello_world()); + run_fut(uninhabited_variant()); }