rust/tests/ui/coroutine/yield-in-initializer.rs

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

18 lines
423 B
Rust
Raw Normal View History

//@ run-pass
2023-10-19 21:46:28 +00:00
#![feature(coroutines)]
fn main() {
#[coroutine] static || { //~ WARN unused coroutine that must be used
loop {
// Test that `opt` is not live across the yield, even when borrowed in a loop
// See https://github.com/rust-lang/rust/issues/52792
let opt = {
yield;
true
};
let _ = &opt;
}
};
}