error[E0597]: `a` does not live long enough --> $DIR/borrowing.rs:9:33 | LL | Pin::new(&mut || yield &a).resume() | -- ^ borrowed value does not live long enough | | | capture occurs here LL | //~^ ERROR: `a` does not live long enough LL | }; | - borrowed value only lives until here ... LL | } | - borrowed value needs to live until here error[E0597]: `a` does not live long enough --> $DIR/borrowing.rs:16:20 | LL | || { | -- capture occurs here LL | yield &a | ^ borrowed value does not live long enough ... LL | }; | - borrowed value only lives until here LL | } | - borrowed value needs to live until here error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0597`.