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

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

19 lines
349 B
Rust
Raw Normal View History

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