rust/tests/ui/for-loop-while/for-loop-into-iterator.rs

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

20 lines
267 B
Rust
Raw Normal View History

//@ run-pass
2015-01-23 02:50:11 +00:00
// Test that for loops can do what RFC #235 claims
2015-01-23 02:50:11 +00:00
fn main() {
let mut v = vec![1];
for x in &v {
assert_eq!(x, &1);
}
for x in &mut v {
assert_eq!(x, &mut 1);
}
for x in v {
assert_eq!(x, 1);
}
}