1 #![feature(generators, generator_trait)]
3 use std::ops::{GeneratorState, Generator};
7 fn reborrow_shared_ref(x: &i32) {
8 // This is OK -- we have a borrow live over the yield, but it's of
9 // data that outlives the generator.
15 Pin::new(&mut b).resume(());
18 fn reborrow_mutable_ref(x: &mut i32) {
19 // This is OK -- we have a borrow live over the yield, but it's of
20 // data that outlives the generator.
26 Pin::new(&mut b).resume(());
29 fn reborrow_mutable_ref_2(x: &mut i32) {
30 // ...but not OK to go on using `x`.
36 println!("{}", x); //~ ERROR
37 Pin::new(&mut b).resume(());