mirror of
https://github.com/allankoechke/rust.git
synced 2026-11-30 11:05:36 +00:00
31 lines
809 B
Rust
31 lines
809 B
Rust
//@ skip-filecheck
|
|
//@ edition:2024
|
|
//@ compile-flags: -Zmir-opt-level=0
|
|
//@ needs-unwind
|
|
|
|
#![feature(stmt_expr_attributes)]
|
|
#![feature(closure_track_caller)]
|
|
#![feature(coroutine_trait)]
|
|
#![feature(coroutines)]
|
|
|
|
use std::ops::{Coroutine, CoroutineState};
|
|
use std::panic::Location;
|
|
use std::pin::Pin;
|
|
|
|
// EMIT_MIR coroutine.main-{closure#0}.StateTransform.diff
|
|
// EMIT_MIR coroutine.main-{closure#1}.StateTransform.diff
|
|
fn main() {
|
|
let simple = #[coroutine]
|
|
|arg: String| {
|
|
yield ("first", arg.clone(), Location::caller());
|
|
yield ("second", arg.clone(), Location::caller());
|
|
};
|
|
|
|
let track_caller = #[track_caller]
|
|
#[coroutine]
|
|
|arg: String| {
|
|
yield ("first", arg.clone(), Location::caller());
|
|
yield ("second", arg.clone(), Location::caller());
|
|
};
|
|
}
|