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