rust/tests/ui/coroutine/borrowing.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
378 B
Rust
Raw Normal View History

2023-10-19 16:46:28 -05:00
#![feature(coroutines, coroutine_trait)]
2017-07-07 18:12:44 -05:00
2023-10-19 11:06:43 -05:00
use std::ops::Coroutine;
2018-10-04 13:49:38 -05:00
use std::pin::Pin;
2017-07-07 18:12:44 -05:00
fn main() {
2017-07-07 18:12:44 -05:00
let _b = {
let a = 3;
Pin::new(&mut || yield &a).resume(())
2017-07-07 18:12:44 -05:00
//~^ ERROR: `a` does not live long enough
};
let _b = {
let a = 3;
|| {
yield &a
//~^ ERROR: `a` does not live long enough
}
};
}