blob: e876f0fb43f65086be101f0aff1f1e98d67c012c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#![feature(generators, generator_trait)]
use std::ops::{Generator, GeneratorState};
fn foo() -> impl Generator<Yield = (), Return = ()> {
//~^ ERROR cannot resolve opaque type
//~| NOTE recursive opaque type
//~| NOTE in this expansion of desugaring of
|| {
//~^ NOTE returning here
let mut gen = Box::pin(foo());
//~^ NOTE generator captures itself here
let mut r = gen.as_mut().resume(());
while let GeneratorState::Yielded(v) = r {
yield v;
r = gen.as_mut().resume(());
}
}
}
fn main() {
foo();
}
|