rust/tests/ui/generator/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 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.
#![feature(generators)]
fn foo(_a: (), _b: &bool) {}
fn bar() {
|| { //~ WARN unused generator 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() { }