rust/tests/ui/coroutine/async-gen-yield-ty-is-unit.rs
Eric Holk 72ce1ab42f
Stabilize noop_waker
Co-authored-by: zachs18 <8355914+zachs18@users.noreply.github.com>
2024-12-05 14:14:17 -08:00

17 lines
374 B
Rust

//@ compile-flags: --edition 2024
//@ check-pass
#![feature(async_iterator, gen_blocks)]
use std::{async_iter::AsyncIterator, pin::pin, task::{Context, Waker}};
async gen fn gen_fn() -> &'static str {
yield "hello"
}
pub fn main() {
let async_iterator = pin!(gen_fn());
let ctx = &mut Context::from_waker(Waker::noop());
async_iterator.poll_next(ctx);
}