Re: [PATCH] rust: device: avoid trailing ; in printing macros

Miguel Ojeda <[email protected]>
Newsgroups org.kernel.vger.rust-for-linux,dev.linux.lists.driver-core,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <CANiq72n3BYGfB9VvLk4-bBQzGy9YhDxFvCrjkjJqBbcJa5YRYw@mail.gmail.com>
On Thu, Jul 16, 2026 at 12:22 PM Alice Ryhl <[email protected]> wrote:
>
> These macros are used like expressions, so they should must 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 <https://github.com/rust-lang/rust/issues/79813>
>    = note: this error originates in the macro `dev_err` (in Nightly builds, run with -Z macro-backtrace for more info)
>
> Cc: [email protected]
> Fixes: 5c7ca6fa603f ("rust: add `dev_*` print macros.")
> Link: https://github.com/rust-lang/rust/issues/79813
> Signed-off-by: Alice Ryhl <[email protected]>

I was doubly surprised since upstream made it a warning by default a
long time ago, and yet we didn't see it; and since I hadn't seen in my
CI even yesterday.

It turns out this just landed into today's nightly:

Link: https://github.com/rust-lang/rust/pull/159222

  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 one that will make it a hard error:

Link: https://github.com/rust-lang/rust/pull/159218

Ok, I will land this into `rust-fixes` then, and send the PR during
the weekend after tomorrow's -next.

Cheers,
Miguel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.