/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 · 3 complexity · 06c85972acf8697227ab0063abadcbd1 MD5 · raw file
- // 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); }