Skip to content

Deny todo!() in tidy#157706

Open
jdonszelmann wants to merge 11 commits into
rust-lang:mainfrom
jdonszelmann:deny-todo
Open

Deny todo!() in tidy#157706
jdonszelmann wants to merge 11 commits into
rust-lang:mainfrom
jdonszelmann:deny-todo

Conversation

@jdonszelmann

@jdonszelmann jdonszelmann commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

@rustbot

rustbot commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in rustc_ty_utils::consts.rs

cc @BoxyUwU

Some changes occurred in compiler/rustc_builtin_macros/src/autodiff.rs

cc @ZuseZ4

Some changes occurred in compiler/rustc_sanitizers

cc @rcvalle

Some changes occurred in match checking

cc @Nadrieril

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

This PR changes rustc_public

cc @oli-obk, @celinval, @ouz-a, @makai410

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

@rustbot rustbot added A-rustdoc-json Area: Rustdoc JSON backend A-tidy Area: The tidy tool PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jun 10, 2026
@rustbot

rustbot commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

r? @Kivooeo

rustbot has assigned @Kivooeo.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 18 candidates

Comment thread library/std/src/sys/net/connection/uefi/mod.rs
Comment thread compiler/rustc_ast_passes/src/diagnostics.rs
@rust-bors

This comment has been minimized.

@Kivooeo Kivooeo added S-waiting-on-MCP Status: PR has a compiler MCP and is waiting for the compiler MCP to complete. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 12, 2026
Comment thread src/tools/tidy/src/style.rs
@JonathanBrouwer JonathanBrouwer removed the S-waiting-on-MCP Status: PR has a compiler MCP and is waiting for the compiler MCP to complete. label Jun 20, 2026
@Kivooeo Kivooeo added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jun 28, 2026
@rustbot

rustbot commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

This PR changes a file inside tests/crashes. If a crash was fixed, please move into the corresponding ui subdir and add 'Fixes #' to the PR description to autoclose the issue upon merge.

Some changes occurred in coverage tests.

cc @Zalathar

Some changes occurred in GUI tests.

cc @GuillaumeGomez

Some changes occurred in HTML/CSS/JS.

cc @GuillaumeGomez, @lolbinarycat

The parser was modified, potentially altering the grammar of (stable) Rust
which would be a breaking change.

cc @fmease

This PR modifies tests/ui/issues/. If this PR is adding new tests to tests/ui/issues/,
please refrain from doing so, and instead add it to more descriptive subdirectories.

@rustbot rustbot added A-CI Area: Our Github Actions CI A-run-make Area: port run-make Makefiles to rmake.rs A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-search Area: Rustdoc's search feature A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` A-testsuite Area: The testsuite used to check the correctness of rustc O-windows Operating system: Windows T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. labels Jun 30, 2026
@rustbot

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@Kivooeo

Kivooeo commented Jul 1, 2026

Copy link
Copy Markdown
Member

Ideally, this would be split into two different PRs:

  • Add this new directive and move everything to it
  • Add a todo check on top of this

@rustbot

rustbot commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job aarch64-gnu-llvm-21-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test [pretty] tests/pretty/autodiff/inherent_impl.rs ... ok
test [pretty] tests/pretty/blank-lines.rs ... ok
test [pretty] tests/pretty/block-comment-multiple-asterisks.rs ... ok
test [pretty] tests/pretty/block-comment-trailing-whitespace.rs ... ok
2026-07-06T11:55:51.853307Z ERROR compiletest::runtest: fatal error, panic: "pretty-printed source does not match expected source\nexpected:\n------------------------------------------\n// This is meant as a test case for Issue 3961.\n//\n// Test via: rustc -Zunpretty normal tests/pretty/block-comment-wchar.rs\n// ignore-tidy-cr\n// ignore-tidy-tab\n//@ pp-exact:block-comment-wchar.pp\nfn f() {\n    fn nested() {\n        /*\n          Spaced2\n        */\n        /*\n          Spaced10\n        */\n        /*\n          Tabbed8+2\n        */\n        /*\n          CR8+2\n        */\n    }\n    /*\n      Spaced2:                       (prefixed so start of space aligns with comment)\n    */\n    /*\n    \t\tTabbed2: (more indented b/c *start* of space will align with comment)\n    */\n    /*\n      Spaced6:                       (Alignment removed and realigning spaces inserted)\n    */\n    /*\n      Tabbed4+2:                     (Alignment removed and realigning spaces inserted)\n    */\n\n    /*\n      VT4+2:                         (should align)\n    */\n    /*\n      FF4+2:                         (should align)\n    */\n    /*\n      CR4+2:                         (should align)\n    */\n    /*\n      NEL4+2:                        (should align)\n    */\n    /*\n      Ogham Space Mark 4+2:          (should align)\n    */\n    /*\n      Ogham Space Mark 4+2: (should align)\n    */\n    /*\n      Four-per-em space 4+2:         (should align)\n    */\n\n    /*\n      Ogham Space Mark   count 1: (should align)\n      Ogham Space Mark   count 2: (should align)\n      Ogham Space Mark   count 3: (should align)\n      Ogham Space Mark   count 4: (should align)\n      Ogham Space Mark   count 5: (should align)\n      Ogham Space Mark   count 6: (should align)\n      Ogham Space Mark   count 7: (should align)\n      Ogham Space Mark   count 8: (should align)\n      Ogham Space Mark   count 9: (should align)\n      Ogham Space Mark   count A: (should align)\n      Ogham Space Mark   count B: (should align)\n      Ogham Space Mark   count C: (should align)\n      Ogham Space Mark   count D: (should align)\n      Ogham Space Mark   count E: (should align)\n      Ogham Space Mark   count F: (should align)\n    */\n\n\n    /* */\n\n    /*\n      Hello from offset 6\n      Space 6+2:                     compare A\n      Ogham Space Mark 6+2: compare B\n    */\n    /*\u{1680}*/\n\n    /*\n      Hello from another offset 6 with wchars establishing column offset\n      Space 6+2:                     compare C\n      Ogham Space Mark 6+2: compare D\n    */\n}\n\nfn main() {\n    // Taken from https://www.unicode.org/Public/UNIDATA/PropList.txt\n    let chars =\n        ['\\x0A', '\\x0B', '\\x0C', '\\x0D', '\\x20', '\\u{85}', '\\u{A0}',\n                '\\u{1680}', '\\u{2000}', '\\u{2001}', '\\u{2002}', '\\u{2003}',\n                '\\u{2004}', '\\u{2005}', '\\u{2006}', '\\u{2007}', '\\u{2008}',\n                '\\u{2009}', '\\u{200A}', '\\u{2028}', '\\u{2029}', '\\u{202F}',\n                '\\u{205F}', '\\u{3000}'];\n    for c in &chars { let ws = c.is_whitespace(); println!(\"{} {}\", c, ws); }\n}\n\n------------------------------------------\nactual:\n------------------------------------------\n// This is meant as a test case for Issue 3961.\n//\n// Test via: rustc -Zunpretty normal tests/pretty/block-comment-wchar.rs\n// ignore-tidy-file-cr\n// ignore-tidy-file-tab\n//@ pp-exact:block-comment-wchar.pp\nfn f() {\n    fn nested() {\n        /*\n          Spaced2\n        */\n        /*\n          Spaced10\n        */\n        /*\n          Tabbed8+2\n        */\n        /*\n          CR8+2\n        */\n    }\n    /*\n      Spaced2:                       (prefixed so start of space aligns with comment)\n    */\n    /*\n    \t\tTabbed2: (more indented b/c *start* of space will align with comment)\n    */\n    /*\n      Spaced6:                       (Alignment removed and realigning spaces inserted)\n    */\n    /*\n      Tabbed4+2:                     (Alignment removed and realigning spaces inserted)\n    */\n\n    /*\n      VT4+2:                         (should align)\n    */\n    /*\n      FF4+2:                         (should align)\n    */\n    /*\n      CR4+2:                         (should align)\n    */\n    /*\n      NEL4+2:                        (should align)\n    */\n    /*\n      Ogham Space Mark 4+2:          (should align)\n    */\n    /*\n      Ogham Space Mark 4+2: (should align)\n    */\n    /*\n      Four-per-em space 4+2:         (should align)\n    */\n\n    /*\n      Ogham Space Mark   count 1: (should align)\n      Ogham Space Mark   count 2: (should align)\n      Ogham Space Mark   count 3: (should align)\n      Ogham Space Mark   count 4: (should align)\n      Ogham Space Mark   count 5: (should align)\n      Ogham Space Mark   count 6: (should align)\n      Ogham Space Mark   count 7: (should align)\n      Ogham Space Mark   count 8: (should align)\n      Ogham Space Mark   count 9: (should align)\n      Ogham Space Mark   count A: (should align)\n      Ogham Space Mark   count B: (should align)\n      Ogham Space Mark   count C: (should align)\n      Ogham Space Mark   count D: (should align)\n      Ogham Space Mark   count E: (should align)\n      Ogham Space Mark   count F: (should align)\n    */\n\n\n    /* */\n\n    /*\n      Hello from offset 6\n      Space 6+2:                     compare A\n      Ogham Space Mark 6+2: compare B\n    */\n    /*\u{1680}*/\n\n    /*\n      Hello from another offset 6 with wchars establishing column offset\n      Space 6+2:                     compare C\n      Ogham Space Mark 6+2: compare D\n    */\n}\n\nfn main() {\n    // Taken from https://www.unicode.org/Public/UNIDATA/PropList.txt\n    let chars =\n        ['\\x0A', '\\x0B', '\\x0C', '\\x0D', '\\x20', '\\u{85}', '\\u{A0}',\n                '\\u{1680}', '\\u{2000}', '\\u{2001}', '\\u{2002}', '\\u{2003}',\n                '\\u{2004}', '\\u{2005}', '\\u{2006}', '\\u{2007}', '\\u{2008}',\n                '\\u{2009}', '\\u{200A}', '\\u{2028}', '\\u{2029}', '\\u{202F}',\n                '\\u{205F}', '\\u{3000}'];\n    for c in &chars { let ws = c.is_whitespace(); println!(\"{} {}\", c, ws); }\n}\n\n------------------------------------------\ndiff:\n------------------------------------------\n1\t// This is meant as a test case for Issue 3961.\n2\t//\n3\t// Test via: rustc -Zunpretty normal tests/pretty/block-comment-wchar.rs\n-\t// ignore-tidy-cr\n-\t// ignore-tidy-tab\n+\t// ignore-tidy-file-cr\n+\t// ignore-tidy-file-tab\n6\t//@ pp-exact:block-comment-wchar.pp\n7\tfn f() {\n8\t    fn nested() {\n\n\n"
test [pretty] tests/pretty/block-comment-wchar.rs ... FAILED
test [pretty] tests/pretty/block-comment-trailing-whitespace2.rs ... ok
test [pretty] tests/pretty/cast-lt.rs ... ok
test [pretty] tests/pretty/block-index-or-call-paren.rs ... ok
test [pretty] tests/pretty/block-disambig.rs ... ok
---
expected:
------------------------------------------
// This is meant as a test case for Issue 3961.
//
// Test via: rustc -Zunpretty normal tests/pretty/block-comment-wchar.rs
// ignore-tidy-cr
// ignore-tidy-tab
//@ pp-exact:block-comment-wchar.pp
fn f() {
    fn nested() {
        /*
          Spaced2
        */
---
    /*
      Spaced2:                       (prefixed so start of space aligns with comment)
    */
    /*
      Tabbed2: (more indented b/c *start* of space will align with comment)
    */
    /*
      Spaced6:                       (Alignment removed and realigning spaces inserted)
    */
    /*
      Tabbed4+2:                     (Alignment removed and realigning spaces inserted)
    */

    /*
      VT4+2:                         (should align)
    */
    /*
      FF4+2:                         (should align)
    */
    /*
      CR4+2:                         (should align)
    */
    /*
      NEL4+2:                        (should align)
    */
    /*
      Ogham Space Mark 4+2:          (should align)
    */
    /*
      Ogham Space Mark 4+2: (should align)
    */
    /*
      Four-per-em space 4+2:         (should align)
    */

    /*
      Ogham Space Mark   count 1: (should align)
      Ogham Space Mark   count 2: (should align)
      Ogham Space Mark   count 3: (should align)
      Ogham Space Mark   count 4: (should align)
      Ogham Space Mark   count 5: (should align)
      Ogham Space Mark   count 6: (should align)
      Ogham Space Mark   count 7: (should align)
      Ogham Space Mark   count 8: (should align)
      Ogham Space Mark   count 9: (should align)
      Ogham Space Mark   count A: (should align)
      Ogham Space Mark   count B: (should align)
      Ogham Space Mark   count C: (should align)
      Ogham Space Mark   count D: (should align)
      Ogham Space Mark   count E: (should align)
      Ogham Space Mark   count F: (should align)
    */


    /* */

    /*
      Hello from offset 6
      Space 6+2:                     compare A
      Ogham Space Mark 6+2: compare B
    */
    /* */

    /*
      Hello from another offset 6 with wchars establishing column offset
      Space 6+2:                     compare C
      Ogham Space Mark 6+2: compare D
    */
}

fn main() {
    // Taken from https://www.unicode.org/Public/UNIDATA/PropList.txt
    let chars =
        ['\x0A', '\x0B', '\x0C', '\x0D', '\x20', '\u{85}', '\u{A0}',
                '\u{1680}', '\u{2000}', '\u{2001}', '\u{2002}', '\u{2003}',
                '\u{2004}', '\u{2005}', '\u{2006}', '\u{2007}', '\u{2008}',
                '\u{2009}', '\u{200A}', '\u{2028}', '\u{2029}', '\u{202F}',
                '\u{205F}', '\u{3000}'];
    for c in &chars { let ws = c.is_whitespace(); println!("{} {}", c, ws); }
}

------------------------------------------
actual:
------------------------------------------
// This is meant as a test case for Issue 3961.
//
// Test via: rustc -Zunpretty normal tests/pretty/block-comment-wchar.rs
// ignore-tidy-file-cr
// ignore-tidy-file-tab
//@ pp-exact:block-comment-wchar.pp
fn f() {
    fn nested() {
        /*
          Spaced2
        */
---
    /*
      Spaced2:                       (prefixed so start of space aligns with comment)
    */
    /*
      Tabbed2: (more indented b/c *start* of space will align with comment)
    */
    /*
      Spaced6:                       (Alignment removed and realigning spaces inserted)
    */
    /*
      Tabbed4+2:                     (Alignment removed and realigning spaces inserted)
    */

    /*
      VT4+2:                         (should align)
    */
    /*
      FF4+2:                         (should align)
    */
    /*
      CR4+2:                         (should align)
    */
    /*
      NEL4+2:                        (should align)
    */
    /*
      Ogham Space Mark 4+2:          (should align)
    */
    /*
      Ogham Space Mark 4+2: (should align)
    */
    /*
      Four-per-em space 4+2:         (should align)
    */

    /*
      Ogham Space Mark   count 1: (should align)
      Ogham Space Mark   count 2: (should align)
      Ogham Space Mark   count 3: (should align)
      Ogham Space Mark   count 4: (should align)
      Ogham Space Mark   count 5: (should align)
      Ogham Space Mark   count 6: (should align)
      Ogham Space Mark   count 7: (should align)
      Ogham Space Mark   count 8: (should align)
      Ogham Space Mark   count 9: (should align)
      Ogham Space Mark   count A: (should align)
      Ogham Space Mark   count B: (should align)
      Ogham Space Mark   count C: (should align)
      Ogham Space Mark   count D: (should align)
      Ogham Space Mark   count E: (should align)
      Ogham Space Mark   count F: (should align)
    */


    /* */

    /*
      Hello from offset 6
      Space 6+2:                     compare A
      Ogham Space Mark 6+2: compare B
    */
    /* */

    /*
      Hello from another offset 6 with wchars establishing column offset
      Space 6+2:                     compare C
      Ogham Space Mark 6+2: compare D
    */
}

fn main() {
    // Taken from https://www.unicode.org/Public/UNIDATA/PropList.txt
    let chars =
        ['\x0A', '\x0B', '\x0C', '\x0D', '\x20', '\u{85}', '\u{A0}',
                '\u{1680}', '\u{2000}', '\u{2001}', '\u{2002}', '\u{2003}',
                '\u{2004}', '\u{2005}', '\u{2006}', '\u{2007}', '\u{2008}',
                '\u{2009}', '\u{200A}', '\u{2028}', '\u{2029}', '\u{202F}',
                '\u{205F}', '\u{3000}'];
    for c in &chars { let ws = c.is_whitespace(); println!("{} {}", c, ws); }
}

------------------------------------------
diff:
------------------------------------------
1 // This is meant as a test case for Issue 3961.
2 //
3 // Test via: rustc -Zunpretty normal tests/pretty/block-comment-wchar.rs
- // ignore-tidy-cr
- // ignore-tidy-tab
+ // ignore-tidy-file-cr
+ // ignore-tidy-file-tab
6 //@ pp-exact:block-comment-wchar.pp
7 fn f() {
8     fn nested() {



@WaffleLapkin WaffleLapkin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a big improvement to how tidy works, but I do have some nits ^^'

View changes since this review

Comment on lines +17 to +23
impl<'a> Default for Directives<'a> {
fn default() -> Self {
Self {
$($name: Directive::default()),*
}
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be just #[derive(Default)]

Comment on lines +70 to +71
/// For drop-bomb behavior
Checked,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you expand on drop-bomb behavior here?

Comment on lines +79 to +82
/// `Ignore(false)` means that an `ignore-tidy-*` directive
/// has been provided, but is unnecessary. `Ignore(true)`
/// means that it is necessary (i.e. a warning would be
/// produced if `ignore-tidy-*` was not present).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This documentation is outdated

Comment on lines +99 to +103
impl<'a> Default for Directive<'a> {
fn default() -> Self {
Self::Deny
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be #[derive(Default)]

Comment on lines +85 to +86
/// Some higher-level rule decides whether this directive is denied or ignored.
Derived(&'a Directive<'a>),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: Why is this necessary?

It looks like this is used to make the child set the used-ness in the parent... But since this is only relevant with Ignore it should just hold Rc<Cell<...>> imo.

Comment on lines +568 to +570
if trimmed.contains("ignore-tidy") {
return false;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: why is this needed?

Comment on lines +625 to +627
let mut fake_directives = Directives::default();
fake_directives.odd_backticks = directive;
fake_directives.check_usage(&mut check, file);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly don't get what's going on here with fake_directives or why we need to store odd_backticks in comment_block...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"binary file not shown" 😭

use run_make_support::{rfs, rustc};

// This test make sure we don't get such following error:
// ignore-tidy-linelength

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is useless? shouldn't tidy have caught it? 🤔

//@ stderr-per-bitwidth
//@ ignore-endian-big
// ignore-tidy-linelength
//@ normalize-stderr: "╾─*ALLOC[0-9]+(\+[a-z0-9]+)?(<imm>)?─*╼" -> "╾ALLOC_ID$1╼"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you add this? doesn't seem like it changed .stderr...

@rustbot

rustbot commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@Kivooeo

Kivooeo commented Jul 6, 2026

Copy link
Copy Markdown
Member

r? wafflelapkin

@rustbot rustbot assigned WaffleLapkin and unassigned Kivooeo Jul 6, 2026
@rustbot

rustbot commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

wafflelapkin is currently at their maximum review capacity.
They may take a while to respond.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CI Area: Our Github Actions CI A-run-make Area: port run-make Makefiles to rmake.rs A-rustdoc-js Area: Rustdoc's JS front-end A-rustdoc-json Area: Rustdoc JSON backend A-rustdoc-search Area: Rustdoc's search feature A-test-infra-minicore Area: `minicore` test auxiliary and `//@ add-core-stubs` A-testsuite Area: The testsuite used to check the correctness of rustc A-tidy Area: The tidy tool O-windows Operating system: Windows PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. T-rustdoc-frontend Relevant to the rustdoc-frontend team, which will review and decide on the web UI/UX output. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants