Skip to content

Commit abcd244

Browse files
committed
add async fn with partial initialization
1 parent fc06cb7 commit abcd244

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/run-pass/async-fn.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#![feature(async_await)]
1+
#![feature(async_await, never_type)]
22

33
use std::{future::Future, pin::Pin, task::Poll, ptr};
44
use std::task::{Waker, RawWaker, RawWakerVTable, Context};
@@ -40,6 +40,11 @@ async fn includes_never(crash: bool, x: u32) -> u32 {
4040
result
4141
}
4242

43+
async fn partial_init(x: u32) -> u32 {
44+
#[allow(unreachable_code)]
45+
let _x: (String, !) = (String::new(), return async { x + x }.await);
46+
}
47+
4348
fn run_fut(mut fut: impl Future<Output=u32>, output: u32) {
4449
fn raw_waker_clone(_this: *const ()) -> RawWaker {
4550
panic!("unimplemented");
@@ -71,4 +76,6 @@ fn main() {
7176
run_fut(build_aggregate(1, 2, 3, 4), 10);
7277

7378
run_fut(includes_never(false, 4), 16);
79+
80+
run_fut(partial_init(4), 8);
7481
}

0 commit comments

Comments
 (0)