-
Notifications
You must be signed in to change notification settings - Fork 898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Braced expressions guarded by #[cfg] attrs are reformatted into invalid syntax #4382
Labels
bug
Panic, non-idempotency, invalid code, etc.
Comments
ayazhafiz
added a commit
to ayazhafiz/rustfmt
that referenced
this issue
Aug 15, 2020
This commit partially reverts rust-lang#3934, opting to create a span that covers the entire body of a closure when formatting a closure body with a block-formatting strategy, rather than having the block-formatting code determine if the visitor pointer should be rewound. The problem with rewinding the visitor pointer is it may be incorrect for other (i.e. non-artificial) AST nodes, as in the case of rust-lang#4382. Closes rust-lang#4382
calebcartwright
pushed a commit
that referenced
this issue
Aug 16, 2020
This commit partially reverts #3934, opting to create a span that covers the entire body of a closure when formatting a closure body with a block-formatting strategy, rather than having the block-formatting code determine if the visitor pointer should be rewound. The problem with rewinding the visitor pointer is it may be incorrect for other (i.e. non-artificial) AST nodes, as in the case of #4382. Closes #4382
calebcartwright
pushed a commit
to calebcartwright/rustfmt
that referenced
this issue
Nov 14, 2020
This commit partially reverts rust-lang#3934, opting to create a span that covers the entire body of a closure when formatting a closure body with a block-formatting strategy, rather than having the block-formatting code determine if the visitor pointer should be rewound. The problem with rewinding the visitor pointer is it may be incorrect for other (i.e. non-artificial) AST nodes, as in the case of rust-lang#4382. Closes rust-lang#4382
calebcartwright
pushed a commit
that referenced
this issue
Nov 14, 2020
This commit partially reverts #3934, opting to create a span that covers the entire body of a closure when formatting a closure body with a block-formatting strategy, rather than having the block-formatting code determine if the visitor pointer should be rewound. The problem with rewinding the visitor pointer is it may be incorrect for other (i.e. non-artificial) AST nodes, as in the case of #4382. Closes #4382
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Given this input file:
rustfmt with default settings converts it into
, which does not parse.
Expected behavior
Formatting code should not generate un-parseable code.
Meta
I can reproduce this on nightly (
rustfmt 2.0.0-rc.2-nightly (0921e1fb 2020-07-29)
) and on https://play.rust-lang.org/The text was updated successfully, but these errors were encountered: