Skip to content
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

regression: rustfmt using input from stdin emits empty output when using #![rustfmt::skip] #5368

Closed
jhgg opened this issue Jun 4, 2022 · 2 comments · Fixed by #5369
Closed
Labels
bug Panic, non-idempotency, invalid code, etc.

Comments

@jhgg
Copy link

jhgg commented Jun 4, 2022

Since #5094 - rustfmt now emits nothing to stdout if reading a file with #![rustfmt::skip] is provided via stdin.

For example, running echo '#![rustfmt::skip]\n\nfn main() { }' | rustfmt no longer emits anything to stdout.

Rust-analyzer uses rustfmt to format files, and sends rustfmt the file contents to format via stdin.

This has caused an interesting issue, where rustfmt emits nothing, so rust-analyzer deletes the contents of the file being formatted: rust-lang/rust-analyzer#12458

@calebcartwright
Copy link
Member

Thank you for the report and bisection!

@calebcartwright calebcartwright added the bug Panic, non-idempotency, invalid code, etc. label Jun 4, 2022
@calebcartwright
Copy link
Member

As I recall the custom tool attributes have only been available on nightly for a while now, so I don't think there's any need to pursue any kind of backport. I'm hoping to cut a new release sometime within the next couple days, and once available on nightly I'll drop a note on the RA issue to share the version that contains the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Panic, non-idempotency, invalid code, etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants