rust/tests/ui/coroutine/yield-in-args-rev.rs

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

20 lines
362 B
Rust
Raw Normal View History

// run-pass
#![allow(dead_code)]
2017-09-20 08:36:20 -05:00
// Test that a borrow that occurs after a yield in the same
// argument list is not treated as live across the yield by
// type-checking.
2023-10-19 16:46:28 -05:00
#![feature(coroutines)]
fn foo(_a: (), _b: &bool) {}
fn bar() {
2023-10-19 16:46:28 -05:00
|| { //~ WARN unused coroutine that must be used
2017-07-15 14:28:42 -05:00
let b = true;
foo(yield, &b);
2017-07-15 14:28:42 -05:00
};
}
fn main() { }