Skip to content

Add a regression test for rust#115145 #3226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions 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() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a link to the issue where this came up.

Then r=me.

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