2023-11-09 10:08:02 +00:00
|
|
|
//@ revisions: current next
|
2024-02-01 11:34:38 +00:00
|
|
|
//@[current] check-pass
|
2023-12-14 12:11:28 +00:00
|
|
|
//@[next] compile-flags: -Znext-solver
|
2023-10-19 21:46:28 +00:00
|
|
|
#![feature(coroutines, coroutine_trait)]
|
2023-01-08 00:29:30 +00:00
|
|
|
|
2023-10-19 16:06:43 +00:00
|
|
|
use std::ops::{Coroutine, CoroutineState};
|
2023-01-08 00:29:30 +00:00
|
|
|
|
2023-10-19 16:06:43 +00:00
|
|
|
fn foo() -> impl Coroutine<Yield = (), Return = ()> {
|
2023-01-08 00:29:30 +00:00
|
|
|
|| {
|
|
|
|
let mut gen = Box::pin(foo());
|
2024-02-01 11:34:38 +00:00
|
|
|
//[next]~^ ERROR type annotations needed
|
|
|
|
//[next]~| ERROR type annotations needed
|
2023-01-08 00:29:30 +00:00
|
|
|
let mut r = gen.as_mut().resume(());
|
2023-10-19 16:06:43 +00:00
|
|
|
while let CoroutineState::Yielded(v) = r {
|
2023-01-08 00:29:30 +00:00
|
|
|
yield v;
|
|
|
|
r = gen.as_mut().resume(());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
foo();
|
|
|
|
}
|