Closed
Description
Here's an example:
https://doc.rust-lang.org/std/ops/trait.Generator.html
Trying to compile it with nightly@play.rust-lang.org (2019-02-04) yields (heh) the following errors:
error[E0599]: no method named `resume` found for type `[generator@src/main.rs:7:25: 10:6 _]` in the current scope
error[E0698]: type inside generator must be known in this context
For reference, here's the example I'm trying to compile:
#![allow(unused)]
#![feature(generators, generator_trait)]
use std::ops::{Generator, GeneratorState};
fn main() {
let mut generator = || {
yield 1;
return "foo"
};
match unsafe { generator.resume() } {
GeneratorState::Yielded(1) => {}
_ => panic!("unexpected return from resume"),
}
match unsafe { generator.resume() } {
GeneratorState::Complete("foo") => {}
_ => panic!("unexpected return from resume"),
}
}