rust/src/test/run-pass/pattern-bound-var-in-for-each.rs

19 lines
347 B
Rust
Raw Normal View History

// Tests that trans_path checks whether a
// pattern-bound var is an upvar (when translating
// the for-each body)
2011-07-27 07:19:39 -05:00
fn foo(src: uint) {
2011-07-27 07:19:39 -05:00
alt some(src) {
2012-08-03 21:59:04 -05:00
some(src_id) => {
2012-06-30 18:19:07 -05:00
for uint::range(0u, 10u) |i| {
2011-07-27 07:19:39 -05:00
let yyy = src_id;
assert (yyy == 0u);
}
2011-07-27 07:19:39 -05:00
}
2012-08-03 21:59:04 -05:00
_ => { }
}
}
fn main() { foo(0u); }