Skip to content

semicolon_in_expressions_from_macros: Lint on non-local macros too#159222

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
joshtriplett:main
Jul 15, 2026
Merged

semicolon_in_expressions_from_macros: Lint on non-local macros too#159222
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
joshtriplett:main

Conversation

@joshtriplett

@joshtriplett joshtriplett commented Jul 13, 2026

Copy link
Copy Markdown
Member

View all comments

The semicolon_in_expressions_from_macros lint previously suppressed
warnings about non-local macros. This masks a lint that will
subsequently become a hard error.

Stop suppressing it, dropping the is_local flag and check.

Fix the test for this case to now expect the error. Drop a separate test
that depended on the lack of error (and that specifically notes it
should be dropped once the lint becomes a hard error).

The `semicolon_in_expressions_from_macros` lint previously suppressed
warnings about non-local macros. This masks a lint that will
subsequently become a hard error.

Stop suppressing it, dropping the `is_local` flag and check.

Fix the test for this case to now expect the error. Drop a separate test
that depended on the lack of error (and that specifically notes it
should be dropped once the lint becomes a hard error).
@joshtriplett joshtriplett added A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) T-lang Relevant to the language team T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. L-semicolon_in_expressions_from_macros Lint: semicolon_in_expressions_from_macros labels Jul 13, 2026
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 13, 2026
@rustbot

rustbot commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

r? @hanna-kruppe

rustbot has assigned @hanna-kruppe.
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 75 candidates
  • Random selection from 18 candidates

@petrochenkov

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 9192337 has been approved by petrochenkov

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 13, 2026
@Urgau

Urgau commented Jul 13, 2026

Copy link
Copy Markdown
Member

Probably deserves to be on the releases notes.

@rustbot label +relnotes

@rustbot rustbot added the relnotes Marks issues that should be documented in the release notes of the next release. label Jul 13, 2026
@rust-log-analyzer

This comment has been minimized.

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 13, 2026
semicolon_in_expressions_from_macros: Lint on non-local macros too

The `semicolon_in_expressions_from_macros` lint previously suppressed
warnings about non-local macros. This masks a lint that will
subsequently become a hard error.

Stop suppressing it, dropping the `is_local` flag and check.

Fix the test for this case to now expect the error. Drop a separate test
that depended on the lack of error (and that specifically notes it
should be dropped once the lint becomes a hard error).
rust-bors Bot pushed a commit that referenced this pull request Jul 13, 2026
…uwer

Rollup of 13 pull requests

Successful merges:

 - #159039 (resolve: fix effective visibilities for items in ambiguous glob sets)
 - #157706 (Deny `todo!()` in tidy)
 - #156712 (Pointer authentication config and user facing options)
 - #158535 (Support `#[track_caller]` on EII declarations)
 - #158632 (First steps of late-bound turbofishing (place FnDef behind a dummy binder))
 - #159002 (Small refactorings in `need_type_info` module)
 - #159202 (Bump rustc-demangle to 0.1.28)
 - #159216 (Avoid using probe self_ty for delegation arguments)
 - #159222 (semicolon_in_expressions_from_macros: Lint on non-local macros too)
 - #156609 (Consider structurally impossible Sized predicates in MIR)
 - #158854 (Add `#[rustc_test_entrypoint_marker]`)
 - #158998 (Some minor ast validation and visiting cleanups)
 - #159123 (doc: clarify attr parser APIs)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 13, 2026
semicolon_in_expressions_from_macros: Lint on non-local macros too

The `semicolon_in_expressions_from_macros` lint previously suppressed
warnings about non-local macros. This masks a lint that will
subsequently become a hard error.

Stop suppressing it, dropping the `is_local` flag and check.

Fix the test for this case to now expect the error. Drop a separate test
that depended on the lack of error (and that specifically notes it
should be dropped once the lint becomes a hard error).
rust-bors Bot pushed a commit that referenced this pull request Jul 13, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #159039 (resolve: fix effective visibilities for items in ambiguous glob sets)
 - #157706 (Deny `todo!()` in tidy)
 - #158535 (Support `#[track_caller]` on EII declarations)
 - #158632 (First steps of late-bound turbofishing (place FnDef behind a dummy binder))
 - #158846 (Fix unused variable warnings for diverging expressions)
 - #159002 (Small refactorings in `need_type_info` module)
 - #159202 (Bump rustc-demangle to 0.1.28)
 - #159216 (Avoid using probe self_ty for delegation arguments)
 - #159222 (semicolon_in_expressions_from_macros: Lint on non-local macros too)
 - #156609 (Consider structurally impossible Sized predicates in MIR)
 - #157993 (Expose more info about ADTs and functions in rustc_public)
 - #158854 (Add `#[rustc_test_entrypoint_marker]`)
 - #158998 (Some minor ast validation and visiting cleanups)
 - #159123 (doc: clarify attr parser APIs)
@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 13, 2026
@rust-bors

rust-bors Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#159236), which was unapproved.

View changes since this unapproval

@joshtriplett

Copy link
Copy Markdown
Member Author

I wasn't expecting this to get r+ed and get pulled into rollups before it passed CI. I'll work on fixing the failures.

@joshtriplett

Copy link
Copy Markdown
Member Author

Looks potentially spurious.

@bors try jobs=test-various

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 14, 2026
semicolon_in_expressions_from_macros: Lint on non-local macros too


try-job: test-various
@rust-bors

rust-bors Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 2b850d5 (2b850d5dbbf142fe9af6c1cf3347eee31bb3bf63)
Base parent: da80ed0 (da80ed0708a09dc096c184345d6eb42cbcd50a1e)

@joshtriplett

Copy link
Copy Markdown
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 15, 2026
@petrochenkov

Copy link
Copy Markdown
Contributor

@bors r+

@rust-bors

rust-bors Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

📌 Commit aa53fee has been approved by petrochenkov

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 15, 2026
rust-bors Bot pushed a commit that referenced this pull request Jul 15, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #159197 (Rename ModDefId to ModId and use more)
 - #159222 (semicolon_in_expressions_from_macros: Lint on non-local macros too)
 - #159296 (Implement `bool::toggle`)
 - #158302 (Fix `overflowing_literals` lint with repeated negation)
 - #158484 (Add documentation for the `cold` and `track_caller` attributes)
 - #159239 (Add codegen test for remainder match)
 - #159330 (fix some edition annotations in UI tests)
 - #159331 (Fix ignore-llvm-version directive in codegen-llvm/array-equality.rs)

Failed merges:

 - #158962 (Add `proc_macro` attribute documentation)
rust-bors Bot pushed a commit that referenced this pull request Jul 15, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #159197 (Rename ModDefId to ModId and use more)
 - #159222 (semicolon_in_expressions_from_macros: Lint on non-local macros too)
 - #159296 (Implement `bool::toggle`)
 - #158302 (Fix `overflowing_literals` lint with repeated negation)
 - #158484 (Add documentation for the `cold` and `track_caller` attributes)
 - #159239 (Add codegen test for remainder match)
 - #159330 (fix some edition annotations in UI tests)
 - #159331 (Fix ignore-llvm-version directive in codegen-llvm/array-equality.rs)

Failed merges:

 - #158962 (Add `proc_macro` attribute documentation)
rust-bors Bot pushed a commit that referenced this pull request Jul 15, 2026
…uwer

Rollup of 8 pull requests

Successful merges:

 - #159197 (Rename ModDefId to ModId and use more)
 - #159222 (semicolon_in_expressions_from_macros: Lint on non-local macros too)
 - #159296 (Implement `bool::toggle`)
 - #158302 (Fix `overflowing_literals` lint with repeated negation)
 - #158484 (Add documentation for the `cold` and `track_caller` attributes)
 - #159239 (Add codegen test for remainder match)
 - #159330 (fix some edition annotations in UI tests)
 - #159331 (Fix ignore-llvm-version directive in codegen-llvm/array-equality.rs)

Failed merges:

 - #158962 (Add `proc_macro` attribute documentation)
@rust-bors
rust-bors Bot merged commit ac05d38 into rust-lang:main Jul 15, 2026
14 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 15, 2026
rust-timer added a commit that referenced this pull request Jul 15, 2026
Rollup merge of #159222 - joshtriplett:main, r=petrochenkov

semicolon_in_expressions_from_macros: Lint on non-local macros too

The `semicolon_in_expressions_from_macros` lint previously suppressed
warnings about non-local macros. This masks a lint that will
subsequently become a hard error.

Stop suppressing it, dropping the `is_local` flag and check.

Fix the test for this case to now expect the error. Drop a separate test
that depended on the lack of error (and that specifically notes it
should be dropped once the lint becomes a hard error).
ojeda pushed a commit to Rust-for-Linux/linux that referenced this pull request Jul 16, 2026
These macros are used like expressions, so they should not emit a
semicolon. This is being turned into a hard error in a future release of
Rust.

    error: trailing semicolon in macro used in expression position
      --> drivers/gpu/nova-core/firmware/fsp.rs:79:34
       |
    79 |                 .inspect_err(|_| dev_err!(dev, "FMC firmware missing '{}' section\n", name))
       |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
       = note: for more information, see issue #79813 <rust-lang/rust#79813>
       = note: this error originates in the macro `dev_err` (in Nightly builds, run with -Z macro-backtrace for more info)

[ I was doubly surprised since upstream made it a deny-by-default lint
  a year ago for Rust 1.91.0, and yet we didn't see it; plus I hadn't
  seen this in my CI even yesterday.

  It turns out this just landed into today's nightly (nightly-2026-07-16,
  using upstream commit d0babd8b6):

    Link: rust-lang/rust#159222

  which says:

    "The `semicolon_in_expressions_from_macros` lint previously
     suppressed warnings about non-local macros. This masks
     a lint that will subsequently become a hard error."

  So that explains it. And this is the PR that will make it a hard error
  at some point in the future:

    Link: rust-lang/rust#159218

  Thus starting with Rust 1.99.0 (expected 2026-10-01), we will be
  seeing the deny-by-default lint above, so clean it up already.

    - Miguel ]

Cc: stable@vger.kernel.org # Needed in 6.18.y and later.
Link: rust-lang/rust#79813
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: rust-lang/rust#159218
Link: rust-lang/rust#159222
Link: https://patch.msgid.link/20260716-device-trail-semicolon-v1-1-f48e9dcfae15@google.com
[ Fixed typo. ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
@ehuss

ehuss commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Just FYI, this is hitting popular crates like nix, which do not have a fix or new version published. Normally we try to not add warnings with popular dependencies that the user cannot update.

@ehuss

ehuss commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

(Interestingly, the reports are blaming nix, but the actual issue is in the cfg_aliases crate.)

pull Bot pushed a commit to AKJUS/cargo that referenced this pull request Jul 16, 2026
The latest nightly has started to warn that `nix` will break in the
future due to `semicolon_in_expressions_from_macros`. The actual issue
is related to `cfg_aliases`, which was affected by
rust-lang/rust#159222.
pull Bot pushed a commit to AKJUS/cargo that referenced this pull request Jul 16, 2026
The latest nightly has started to warn that `nix` will break in the
future due to `semicolon_in_expressions_from_macros`. The actual issue
is related to `cfg_aliases`, which was affected by
rust-lang/rust#159222.
ojeda pushed a commit to Rust-for-Linux/linux that referenced this pull request Jul 16, 2026
These macros are used like expressions, so they should not emit a
semicolon. This is being turned into a hard error in a future release of
Rust.

    error: trailing semicolon in macro used in expression position
      --> drivers/gpu/nova-core/firmware/fsp.rs:79:34
       |
    79 |                 .inspect_err(|_| dev_err!(dev, "FMC firmware missing '{}' section\n", name))
       |                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       |
       = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
       = note: for more information, see issue #79813 <rust-lang/rust#79813>
       = note: this error originates in the macro `dev_err` (in Nightly builds, run with -Z macro-backtrace for more info)

[ I was doubly surprised since upstream made it a deny-by-default lint
  a year ago for Rust 1.91.0, and yet we didn't see it; plus I hadn't
  seen this in my CI even yesterday.

  It turns out this just landed into today's nightly (nightly-2026-07-16,
  using upstream commit d0babd8b6):

    Link: rust-lang/rust#159222

  which says:

    "The `semicolon_in_expressions_from_macros` lint previously
     suppressed warnings about non-local macros. This masks
     a lint that will subsequently become a hard error."

  So that explains it. And this is the PR that will make it a hard error
  at some point in the future:

    Link: rust-lang/rust#159218

  Thus starting with Rust 1.99.0 (expected 2026-10-01), we will be
  seeing the deny-by-default lint above, so clean it up already.

    - Miguel ]

Cc: stable@vger.kernel.org # Needed in 6.18.y and later.
Link: rust-lang/rust#79813
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Acked-by: Danilo Krummrich <dakr@kernel.org>
Link: rust-lang/rust#159218
Link: rust-lang/rust#159222
Link: https://patch.msgid.link/20260716-device-trail-semicolon-v1-1-f48e9dcfae15@google.com
[ Fixed typo. ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-macros Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..) L-semicolon_in_expressions_from_macros Lint: semicolon_in_expressions_from_macros relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants