about summary refs log tree commit diff
path: root/src/tools/rustfmt/tests/target/postfix-yield.rs
blob: 8ee34ec431226f64d458fdcc7b2e8d1f38cf88b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// This demonstrates a proposed alternate or additional option of having yield in postfix position.
//@ edition: 2024

#![feature(gen_blocks, coroutines, coroutine_trait, yield_expr)]

use std::ops::{Coroutine, CoroutineState};
use std::pin::pin;

fn main() {
    let mut coro = pin!(
        #[coroutine]
        |_: i32| {
            let x = 1.yield;
            (x + 2).await;
        }
    );
}