This happens because the for loop calls into_iter on r1, which takes ownership of it. There are no references here, only moves.
What you are suggesting wouldn't work with shared references, because iterators must be mutable to update their state when next() is called. Thus you need to write this if you want to use your original range:
fn main() {
let mut r1 = 0..10;
for x in &mut r1 {
println!("{}", x);
}
println!("{}", r1.len());
}
You can never iterate over an immutable iterator, so you either need to use a mut reference, or pass ownership.
Ah, good point. Depending on what you want to happen with your iterator, the piece of code that skysch posted and the piece of code that I posted do not do the same.
skysch's prints "0" as the length of the range after the loop and mine prints "10". So which of these variants you should use depends on what you want to achieve.