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 13:34:03 +00:00
2018-10-04 18:49:38 +00:00
use std::marker::Unpin;
2023-10-19 16:06:43 +00:00
use std::ops::Coroutine;
2017-08-09 20:56:19 +00:00
2023-10-19 16:06:43 +00:00
pub fn foo() -> impl Coroutine<(), Yield = (), Return = ()> {
#[coroutine]
2017-08-09 20:56:19 +00:00
|| {
2017-08-09 23:38:05 +00:00
if false {
2017-08-09 20:56:19 +00:00
yield;
}
}
2017-07-11 19:57:05 +00:00
}
2017-08-09 23:38:05 +00: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 23:38:05 +00:00
}