blob: 14daa2e9c357060f9f120c6db3b4a6314abc992f [file] [log] [blame]
// compile-flags: --edition 2024 -Zunstable-options
#![feature(gen_blocks)]
//! This test checks that we don't allow self-referential generators
fn main() {
let mut x = {
let mut x = gen {
let y = 42;
let z = &y; //~ ERROR: borrow may still be in use when `gen` block yields
yield 43;
panic!("{z}");
};
x.next();
Box::new(x)
};
x.next();
}