about summary refs log tree commit diff
path: root/tests/ui/coroutine/borrowing.rs
blob: a6628766c1bad1ea366c56aa6b929f985851e813 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#![feature(coroutines, coroutine_trait, stmt_expr_attributes)]

use std::ops::Coroutine;
use std::pin::Pin;

fn main() {
    let _b = {
        let a = 3;
        Pin::new(&mut #[coroutine] || yield &a).resume(())
        //~^ ERROR: `a` does not live long enough
    };

    let _b = {
        let a = 3;
        #[coroutine] || {
            yield &a
            //~^ ERROR: `a` does not live long enough
        }
    };
}