Skip to content

Commit

Permalink
Auto merge of rust-lang#3226 - saethlin:deadpool-test, r=RalfJung
Browse files Browse the repository at this point in the history
Add a regression test for rust#115145

Per rust-lang#118805 (comment)
  • Loading branch information
bors committed Dec 15, 2023
2 parents c9e0610 + afcf01c commit fcb89b3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/tools/miri/tests/pass/async-fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand All @@ -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());
}

0 comments on commit fcb89b3

Please sign in to comment.