1 #![feature(generators, generator_trait)]
3 use std::ops::{GeneratorState, Generator};
7 fn borrow_local_inline() {
8 // Not OK to yield with a borrow of a temporary.
10 // (This error occurs because the region shows up in the type of
11 // `b` and gets extended by region inference.)
14 //~^ ERROR borrow may still be in use when generator yields
18 Pin::new(&mut b).resume(());
21 fn borrow_local_inline_done() {
22 // No error here -- `a` is not in scope at the point of `yield`.
29 Pin::new(&mut b).resume(());
33 // Not OK to yield with a borrow of a temporary.
35 // (This error occurs because the region shows up in the type of
36 // `b` and gets extended by region inference.)
41 //~^ ERROR borrow may still be in use when generator yields
46 Pin::new(&mut b).resume(());