Skip to content

Conversation

compiler-errors
Copy link
Member

This needs a bit of cleanup, but it fixes a strange inconsistency where macro_call!(); as a StmtKind::Semi would not actually include the span of the semicolon at the end of the mac call. This led to some hacks to actually make this so.

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler 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. labels Jul 31, 2025
@rust-log-analyzer
Copy link
Collaborator

The job pr-check-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
    Checking toml v0.7.8
error: unreachable pattern
   --> src/tools/clippy/clippy_utils/src/ast_utils/mod.rs:307:9
    |
306 |         (Empty, Empty) => true,
    |         -------------- matches any value
307 |         (MacCall(l), MacCall(r)) => {
    |         ^^^^^^^^^^^^^^^^^^^^^^^^ no value can reach this
    |
    = note: `-D unreachable-patterns` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unreachable_patterns)]`

---
    |
note: multiple earlier patterns match some of the same values
   --> src/tools/clippy/clippy_utils/src/ast_utils/mod.rs:310:9
    |
298 |         (Let(l), Let(r)) => {
    |         ---------------- matches some of the same values
...
304 |         (Item(l), Item(r)) => eq_item(l, r, eq_item_kind),
    |         ------------------ matches some of the same values
305 |         (Expr(l), Expr(r)) | (Semi(l), Semi(r)) => eq_expr(l, r),
    |         --------------------------------------- matches some of the same values
306 |         (Empty, Empty) => true,
    |         -------------- matches some of the same values
...
310 |         _ => false,
---
    = note: `-D unused-variables` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unused_variables)]`
help: if this is intentional, prefix it with an underscore
    |
306 |         (_Empty, _Empty) => true,
    |          +       +

[RUSTC-TIMING] backtrace test:false 0.325
    Checking unicode-normalization v0.1.24
[RUSTC-TIMING] toml test:false 0.330

@petrochenkov petrochenkov self-assigned this Jul 31, 2025
@petrochenkov
Copy link
Contributor

IIRC, the mess around the statement syntax was user-observable via stmt matchers or something like that, so it was not fixed several years ago.
In general the rules here should be guided by something like #61733 (comment).

@bors
Copy link
Collaborator

bors commented Aug 7, 2025

☔ The latest upstream changes (presumably #145056) made this pull request unmergeable. Please resolve the merge conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants