rust/src/test/run-pass/pattern-bound-var-in-for-each.rs
2012-08-26 15:56:16 -07:00

19 lines
349 B
Rust

// Tests that trans_path checks whether a
// pattern-bound var is an upvar (when translating
// the for-each body)
fn foo(src: uint) {
match Some(src) {
Some(src_id) => {
for uint::range(0u, 10u) |i| {
let yyy = src_id;
assert (yyy == 0u);
}
}
_ => { }
}
}
fn main() { foo(0u); }