mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-23 22:14:15 +00:00
20 lines
267 B
Rust
20 lines
267 B
Rust
//@ run-pass
|
|
// Test that for loops can do what RFC #235 claims
|
|
|
|
|
|
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);
|
|
}
|
|
}
|