From ace1fa82b9b01222ca8b317cb21ad47645aeadfb Mon Sep 17 00:00:00 2001 From: Ben Kimock Date: Wed, 13 Dec 2023 23:58:44 -0500 Subject: [PATCH] Add a regression test for #115145 --- .../pass/uninhabited-coroutine-variant.rs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/tools/miri/tests/pass/uninhabited-coroutine-variant.rs diff --git a/src/tools/miri/tests/pass/uninhabited-coroutine-variant.rs b/src/tools/miri/tests/pass/uninhabited-coroutine-variant.rs new file mode 100644 index 0000000000000..1f42d3b0f919c --- /dev/null +++ b/src/tools/miri/tests/pass/uninhabited-coroutine-variant.rs @@ -0,0 +1,25 @@ +#![feature(noop_waker)] +use std::future::Future; + +enum Runtime {} + +async fn run(_: Runtime) {} + +async fn apply_timeout() { + let c = async {}; + match None:: { + None => { + c.await; + }, + Some(r) => { + run(r).await; + } + } +} + +fn main() { + let waker = std::task::Waker::noop(); + let mut ctx = std::task::Context::from_waker(&waker); + let fut = std::pin::pin!(apply_timeout()); + let _ = fut.poll(&mut ctx); +}