-
Notifications
You must be signed in to change notification settings - Fork 941
Closed
Labels
2x-port:pendingbugPanic, non-idempotency, invalid code, etc.Panic, non-idempotency, invalid code, etc.good first issueIssues up for grabs, also good candidates for new rustfmt contributorsIssues up for grabs, also good candidates for new rustfmt contributorshelp wanted
Description
If the subset of a variable name is "in" inside of the for-loop's for ... in
section and requires formatting with a comment around the in-keyword, an invalid output is produced.
For this input:
fn main() {
for variable_in_here /* ... */ in 0..1 {}
for variable_in_here in /* ... */ 0..1 {}
for variable_in_here
in /* ... */ 0..1 {}
for variable_in_here
/* ... */ in 0..1 {}
}
The output becomes invalid syntax:
fn main() {
for variable_in_here in _here /* ... */ in 0..1 {}
for variable_in_here in _here in /* ... */ 0..1 {}
for variable_in_here in
_here
in /* ... */
0..1
{}
for variable_in_here in
_here
/* ... */ in
0..1
{}
}
If the characters "in" are removed from the input, the output will remain valid syntax:
fn main() {
for variable__here /* ... */ in 0..1 {}
for variable__here in /* ... */ 0..1 {}
for variable__here in /* ... */ 0..1 {}
for variable__here
/* ... */ in 0..1 {}
}
$ rustfmt --version
rustfmt 1.4.37-stable (a178d03 2021-07-26)
Metadata
Metadata
Assignees
Labels
2x-port:pendingbugPanic, non-idempotency, invalid code, etc.Panic, non-idempotency, invalid code, etc.good first issueIssues up for grabs, also good candidates for new rustfmt contributorsIssues up for grabs, also good candidates for new rustfmt contributorshelp wanted