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

22 lines
404 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)
use std;
import std::option::*;
import std::uint;
2011-07-27 07:19:39 -05:00
fn foo(src: uint) {
2011-07-27 07:19:39 -05:00
alt some(src) {
some(src_id) {
for each i: uint in uint::range(0u, 10u) {
let yyy = src_id;
assert (yyy == 0u);
}
2011-07-27 07:19:39 -05:00
}
_ { }
}
}
2011-07-27 07:19:39 -05:00
fn main() { foo(0u); }