Skip to content

rustfmt prints "rewriting static" in its output #6210

Closed
rust-lang/rust
#126888

Description

@asomers

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

Activity

  1. compiler-errors commented on Jun 24, 2024

    @compiler-errors
    Contributor

    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.

  2. calebcartwright commented on Jun 24, 2024

    @calebcartwright
    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)

  3. compiler-errors commented on Jun 24, 2024

    @compiler-errors
    Contributor

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

  4. added a commit that references this issue on Jun 24, 2024
  5. added a commit that references this issue on Jun 24, 2024
  6. added a commit that references this issue on Jun 24, 2024
  7. rami3l commented on Jun 24, 2024

    @rami3l
    Member

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

  8. calebcartwright commented on Jun 24, 2024

    @calebcartwright
    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

  9. calebcartwright commented on Jun 24, 2024

    @calebcartwright
    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

  10. RalfJung commented on Jun 24, 2024

    @RalfJung
    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.

  11. robertbastian commented on Jun 25, 2024

    @robertbastian

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

  12. added a commit that references this issue on Jun 26, 2024
  13. calebcartwright commented on Jun 26, 2024

    @calebcartwright
    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

  14. added a commit that references this issue on Jul 1, 2024
  15. unpinned this issue on Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions