2018-09-06 14:41:12 +02:00
|
|
|
// run-pass
|
|
|
|
|
2018-07-31 21:54:30 +02:00
|
|
|
#![feature(generators)]
|
|
|
|
|
|
|
|
fn main() {
|
2020-07-28 00:00:00 +00:00
|
|
|
static || { //~ WARN unused generator that must be used
|
2018-07-31 21:54:30 +02:00
|
|
|
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
|
|
|
|
};
|
2021-06-18 15:09:40 +08:00
|
|
|
let _ = &opt;
|
2018-07-31 21:54:30 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|