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
363 B
Rust
Raw Normal View History

//@ run-pass
#![allow(dead_code)]
2017-09-20 13:36:20 +00: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 21:46:28 +00:00
#![feature(coroutines)]
fn foo(_a: (), _b: &bool) {}
fn bar() {
2023-10-19 21:46:28 +00:00
|| { //~ WARN unused coroutine that must be used
2017-07-15 19:28:42 +00:00
let b = true;
foo(yield, &b);
2017-07-15 19:28:42 +00:00
};
}
fn main() { }