rustc internally converts for val in iter { ... } to:
match &mut iter {
i =>
loop { match i.next() { None => break , Some(val) => { ... } } }
}
where i is created by let local_ident = token::gensym_ident("i");, so i does not clash with other local variables.
However, pprust just prints it as plain i. So the following code:
let mut i: int = 0;
for _ in iter {
i += 1;
}
is prettified by rustc as:
let mut i: int = 0;
match &mut iter {
i =>
loop { match i.next() { None => break , Some(_) => { i += 1; } } }
}
which is not correct anymore.
rustc internally converts
for val in iter { ... }to:where
iis created bylet local_ident = token::gensym_ident("i");, soidoes not clash with other local variables.However, pprust just prints it as plain
i. So the following code:is prettified by rustc as:
which is not correct anymore.