Files
rust/tests/ui/coroutine/auxiliary/xcrate.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
432 B
Rust
Raw Normal View History

#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
2016-12-26 14:34:03 +01:00
2018-10-04 20:49:38 +02:00
use std::marker::Unpin;
2023-10-19 16:06:43 +00:00
use std::ops::Coroutine;
2017-08-09 13:56:19 -07:00
2023-10-19 16:06:43 +00:00
pub fn foo() -> impl Coroutine<(), Yield = (), Return = ()> {
#[coroutine]
2017-08-09 13:56:19 -07:00
|| {
2017-08-09 16:38:05 -07:00
if false {
2017-08-09 13:56:19 -07:00
yield;
}
}
2017-07-11 12:57:05 -07:00
}
2017-08-09 16:38:05 -07:00
2023-10-19 16:06:43 +00:00
pub fn bar<T: 'static>(t: T) -> Box<Coroutine<(), Yield = T, Return = ()> + Unpin> {
Box::new(
#[coroutine]
|| {
yield t;
},
)
2017-08-09 16:38:05 -07:00
}