The compiler says that e1: &i32 and e2: i32. Having read the docs for slice::Iter and the book chapter on loops, I'm still confused.
More generally, can a particular element in a slice be owned? It seems like in case 2, e2 is owning an element, is it?
fn main() {
let slice = &[1, 2, 3];
for e1 in slice.iter() {
println!("{}", e1); // case 1
}
for &e2 in slice.iter() {
println!("{}", e2); // case 2
}
}