error[E0597]: `a` does not live long enough --> $DIR/borrowing.rs:18:29 | LL | unsafe { (|| 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:25: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`.