about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBen Kimock <kimockb@gmail.com>2023-12-14 18:22:23 -0500
committerBen Kimock <kimockb@gmail.com>2023-12-15 10:04:07 -0500
commitafcf01c238033bcd0ef99008d1242c3ecac40a64 (patch)
tree407e6bd986218e703c53aa9b5e3a69aa72a7b8d4
parent5747646aab51c430690afa993aa5268cfd00cd8c (diff)
downloadrust-afcf01c238033bcd0ef99008d1242c3ecac40a64.tar.gz
rust-afcf01c238033bcd0ef99008d1242c3ecac40a64.zip
Add the test minimized from deadpool
-rw-r--r--src/tools/miri/tests/pass/async-fn.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/tools/miri/tests/pass/async-fn.rs b/src/tools/miri/tests/pass/async-fn.rs
index 69f35afe86c..6c92735df0a 100644
--- a/src/tools/miri/tests/pass/async-fn.rs
+++ b/src/tools/miri/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::<Never> {
+        None => {
+            c.await;
+        }
+        Some(r) => {
+            unreachable(r).await;
+        }
+    }
+}
+
 fn run_fut<T>(fut: impl Future<Output = T>) -> 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());
 }