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

rustfmt prints "rewriting static" in its output #6210

Closed
asomers opened this issue Jun 24, 2024 · 9 comments · Fixed by rust-lang/rust#126888
Closed

rustfmt prints "rewriting static" in its output #6210

asomers opened this issue Jun 24, 2024 · 9 comments · Fixed by rust-lang/rust#126888

Comments

@asomers
Copy link

asomers commented Jun 24, 2024

Commit 30cdc2b from #6204 included what looks like a debugging println! that causes rustfmt to generate invalid rust code. I don't have a minimal test case, but it's causing failures in combination with bindgen in at least 3 other crates.
Downstream bug: rust-lang/rust#126887

@compiler-errors
Copy link
Member

I've put up a fix in-tree in rust-lang/rust rust-lang/rust#126888 which can later get subtree-sync'd here. @calebcartwright @ytmimi i'm happy to perform the rust->rustfmt subtree sync to pull this in if you'd like.

@calebcartwright
Copy link
Member

Definitely agreed with getting the fix in directly. If you're up for doing a subtree push to bring that over here then that's helpful as well (though not urgent nor impactful on this side)

@compiler-errors
Copy link
Member

Cool, I can do a push tomorrow when this lands.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 24, 2024
…g, r=dtolnay

Remove stray println from rustfmt's `rewrite_static`

r? `@calebcartwright` `@ytmimi` -- though anyone should probably r+ this so it gets into nightly sooner than later, since it's obviously wrong.

This can just be fixed in-tree, since I don't think we want to wait until the next sync to fix this.

Fix rust-lang/rustfmt#6210
Fix rust-lang#126887
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Jun 24, 2024
Rollup merge of rust-lang#126888 - compiler-errors:oops-debug-printing, r=dtolnay

Remove stray println from rustfmt's `rewrite_static`

r? `@calebcartwright` `@ytmimi` -- though anyone should probably r+ this so it gets into nightly sooner than later, since it's obviously wrong.

This can just be fixed in-tree, since I don't think we want to wait until the next sync to fix this.

Fix rust-lang/rustfmt#6210
Fix rust-lang#126887
chrysn added a commit to chrysn-pull-requests/rust-psa-crypto that referenced this issue Jun 24, 2024
This is a band-aid over [6210] that will make CI steps pass while a
broken rustfmt is in nightly.

[6210]: rust-lang/rustfmt#6210
@rami3l
Copy link
Member

rami3l commented Jun 24, 2024

@calebcartwright Maybe adding some disallowed rules (https://rust-lang.github.io/rust-clippy/master/#/disallowed) will prevent this from happening again?

@calebcartwright
Copy link
Member

rust-lang/rust#126888 landed but I guess github won't close cross-repo issues still

this issue is resolved (and should only exist in a single nightly release), and there's no additional action to take here so i'm going to close

@calebcartwright
Copy link
Member

@calebcartwright Maybe adding some disallowed rules (https://rust-lang.github.io/rust-clippy/master/#/disallowed) will prevent this from happening again?

certainly an option, although we don't regularly run clippy on this repo and don't gate CI on a passing clippy check

i'm also surprised that this didn't cause any test failures. if the issue was only reproducible when running rustfmt with stdin/stdout (which is how RA internally uses rustfmt) then that would explain the lack of test failures, but if it was reproducible via standard rustfmt execution against a file then i'm really puzzled how there wasn't mass failure of tests

@calebcartwright calebcartwright pinned this issue Jun 24, 2024
calebcartwright referenced this issue Jun 24, 2024
This includes both `ast::StaticItem` and `ast::StaticForeignItem`.
`safety` was added to both `ast::StaticItem` and `ast::SaticForeignItem`
in rust-lang/rust#124482.
@RalfJung
Copy link
Member

i'm also surprised that this didn't cause any test failures. if the issue was only reproducible when running rustfmt with stdin/stdout (which is how RA internally uses rustfmt) then that would explain the lack of test failures, but if it was reproducible via standard rustfmt execution against a file then i'm really puzzled how there wasn't mass failure of tests

In standard rustfmt execution, the message appears in the terminal but not in the file. So it doesn't break anything.

compiler-errors pushed a commit to compiler-errors/rustfmt that referenced this issue Jun 25, 2024
Remove stray println from rustfmt's `rewrite_static`

r? `@calebcartwright` `@ytmimi` -- though anyone should probably r+ this so it gets into nightly sooner than later, since it's obviously wrong.

This can just be fixed in-tree, since I don't think we want to wait until the next sync to fix this.

Fix rust-lang#6210
Fix rust-lang/rust#126887
@robertbastian
Copy link

I don't see stdin documented by rustfmt --help. Is this not something that is meant to be public?

Nadrieril added a commit to Nadrieril/hax that referenced this issue Jun 26, 2024
@calebcartwright
Copy link
Member

I don't see stdin documented by rustfmt --help. Is this not something that is meant to be public?

You're right that's not explicitly clear in the help text, but it's also not something that's intended to be a secret: https://github.com/rust-lang/rustfmt?tab=readme-ov-file#running-rustfmt-directly

AlphaKeks added a commit to AlphaKeks/cs2kz-api that referenced this issue Jul 1, 2024
@calebcartwright calebcartwright unpinned this issue Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants