1 #![feature(coroutines, coroutine_trait, stmt_expr_attributes)]
4 use std
::ops
::{Coroutine, CoroutineState}
;
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 coroutine.
10 let mut b
= #[coroutine]
16 Pin
::new(&mut b
).resume(());
19 fn reborrow_mutable_ref(x
: &mut i32) {
20 // This is OK -- we have a borrow live over the yield, but it's of
21 // data that outlives the coroutine.
22 let mut b
= #[coroutine]
28 Pin
::new(&mut b
).resume(());
31 fn reborrow_mutable_ref_2(x
: &mut i32) {
32 // ...but not OK to go on using `x`.
33 let mut b
= #[coroutine]
39 println
!("{}", x
); //~ ERROR
40 Pin
::new(&mut b
).resume(());