-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Open
Labels
A-hygieneArea: Macro hygieneArea: Macro hygieneA-prettyArea: Pretty printing (including `-Z unpretty`)Area: Pretty printing (including `-Z unpretty`)C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.
Description
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.
Metadata
Metadata
Assignees
Labels
A-hygieneArea: Macro hygieneArea: Macro hygieneA-prettyArea: Pretty printing (including `-Z unpretty`)Area: Pretty printing (including `-Z unpretty`)C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.P-lowLow priorityLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way. When possible, use a F-* label instead.This issue requires a nightly compiler in some way. When possible, use a F-* label instead.