PageRenderTime 11ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://github.com/jruderman/rust
Rust | 18 lines | 12 code | 3 blank | 3 comment | 2 complexity | 06c85972acf8697227ab0063abadcbd1 MD5 | raw file
 1// Tests that trans_path checks whether a
 2// pattern-bound var is an upvar (when translating
 3// the for-each body)
 4
 5fn foo(src: uint) {
 6
 7    match some(src) {
 8      some(src_id) => {
 9        for uint::range(0u, 10u) |i| {
10            let yyy = src_id;
11            assert (yyy == 0u);
12        }
13      }
14      _ => { }
15    }
16}
17
18fn main() { foo(0u); }