Skip to content

Tidy complains about itself when remap-debuginfo = true #164567

Closed

Description

@xlambein

If I set remap-debuginfo = true in bootstrap.toml (for example, by setting profile = "dist"), and then run ./x test tidy, I get a series of style errors in src/tools/tidy/src/style.rs itself:

Details
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:10: TODO is used for tasks that should be done before merging a PR;
If you want to leave a message in the codebase use FIXME
 >> TODO: ` or `XXX` directives.
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:115: Don't use magic numbers that spell things (consider 0x12345678)
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:116: Don't use magic numbers that spell things (consider 0x12345678)
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:117: Don't use magic numbers that spell things (consider 0x12345678)
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:441: `dbg!` macro is intended as a debugging tool. It should not be in version control.
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:451: `dbg!` macro is intended as a debugging tool. It should not be in version control.
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:457: the `todo!` macro is used for tasks that should be done before merging a PR.
If you want to panic here, use `panic!`, `unimplemented!`, `unreachable!`, `rustc_middle::bug!` or an assertion
 >> TODO: "
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:465: the `todo!` macro is used for tasks that should be done before merging a PR.
If you want to panic here, use `panic!`, `unimplemented!`, `unreachable!`, `rustc_middle::bug!` or an assertion
 >> TODO: "todo in line because of previous check"
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:473: TODO is used for tasks that should be done before merging a PR;
If you want to leave a message in the codebase use FIXME
 >> TODO: {}", without_end)
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:479: the `todo!` macro is used for tasks that should be done before merging a PR.
If you want to panic here, use `panic!`, `unimplemented!`, `unreachable!`, `rustc_middle::bug!` or an assertion
 >> TODO: ` macro is used for tasks that should be done before merging a PR.\nIf you want to panic here, use `panic!`, `unimplemented!`, `unreachable!`, `rustc_middle::bug!` or an assertion{message}"
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:530: TODO is used for tasks that should be done before merging a PR;
If you want to leave a message in the codebase use FIXME
 >> TODO: ") {
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:532: TODO is used for tasks that should be done before merging a PR;
If you want to leave a message in the codebase use FIXME
 >> TODO: ").expect("TODO in line because of previous check").1;
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:538: TODO is used for tasks that should be done before merging a PR;
If you want to leave a message in the codebase use FIXME
 >> TODO: {}", without_colon)
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:543: TODO is used for tasks that should be done before merging a PR;
If you want to leave a message in the codebase use FIXME
 >> TODO: is used for tasks that should be done before merging a PR;\nIf you want to leave a message in the codebase use FIXME{message}",
tidy [style (src)]: /path/to/rust/src/tools/tidy/src/style.rs:546: Instead of XXX use FIXME
tidy [style (src)]: FAIL
tidy: The following check failed: style (src)

Seems to be caused by the recent change to make bootstrap use Cargo trim-path: #161049. The issue is that it remaps file!() from /path/to/rust/<relative_path> to /rustc/<hash>/<relative_path>. However, tidy still uses the original path when checking.

A quick fix could be to hardcode the path to style.rs, the way it's already done for codegen.rs, but maybe there's something smarter to do here 😄 Happy to look into that some more.

Activity

  1. added
    T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
    C-bugCategory: This is a bug.
    on Oct 19, 2026
  2. added
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    on Oct 19, 2026
  3. xlambein commented on Oct 19, 2026

    @xlambein
    Author

    I'm finding other issues connected to remap-debuginfo. For example, if I run ./x test src/bootstrap with that option enabled, I get 68 failures in the snapshot tests, because it's trying to read the snapshots from /rustc/<hash>/..., which of course does not exist.

  4. Kobzol commented on Oct 19, 2026

    @Kobzol
    Member

    Bootstrap has hundreds of configuration knobs, any many of them will somehow break tests. That's not to say that we can't make some of them work, but it's kinda expected that changing the config can produce broken tests or toolchains.

  5. added
    T-styleRelevant to the style team, which will review and decide on the PR/issue.
    A-tidyArea: The tidy tool
    and removed
    needs-triageThis issue may need triage. Remove when done. See docs forge.rust-lang.org/release/issue-triaging
    T-styleRelevant to the style team, which will review and decide on the PR/issue.
    on Oct 19, 2026
  6. paradoxicalguy commented on Oct 21, 2026

    @paradoxicalguy
    Contributor

    @rustbot claim

  7. paradoxicalguy commented on Oct 21, 2026

    @paradoxicalguy
    Contributor

    well, hardcoding a path works, it passes python x.py test tidy
    both w debuginfo-remap as true and false.

    // In some cases, a style check would be triggered by its own implementation
    // or comments. Use a repository-relative path because file!() may be remapped.
    let this_file = Path::new("src/tools/tidy/src/style.rs");
    let codegen_file = Path::new("src/tools/tidy/src/codegen.rs");
    
  8. added 2 commits that reference this issue on Oct 21, 2026
  9. added a commit that references this issue on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

A-tidyArea: The tidy toolC-bugCategory: This is a bug.T-bootstrapRelevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)requires-custom-configThis issue requires custom config/build for rustc in some way

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions