rust/src/test/run-pass/borrowck-wg-borrow-mut-to-imm-3.rs
Daniel Micay 1008945528 remove obsolete foreach keyword
this has been replaced by `for`
2013-08-03 22:48:02 -04:00

19 lines
320 B
Rust

struct Wizard {
spells: ~[&'static str]
}
impl Wizard {
pub fn cast(&mut self) {
for &spell in self.spells.iter() {
println(spell);
}
}
}
pub fn main() {
let mut harry = Wizard {
spells: ~[ "expelliarmus", "expecto patronum", "incendio" ]
};
harry.cast();
}