rust/tests/ui/binding/pattern-bound-var-in-for-each.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

21 lines
379 B
Rust
Raw Normal View History

// run-pass
2018-05-08 08:10:16 -05:00
// Tests that codegen_path checks whether a
// pattern-bound var is an upvar (when codegenning
// the for-each body)
fn foo(src: usize) {
2012-08-20 14:23:37 -05:00
match Some(src) {
Some(src_id) => {
for _i in 0_usize..10_usize {
2011-07-27 07:19:39 -05:00
let yyy = src_id;
assert_eq!(yyy, 0_usize);
}
2011-07-27 07:19:39 -05:00
}
2012-08-03 21:59:04 -05:00
_ => { }
}
}
pub fn main() { foo(0_usize); }