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 | <CANiq72nhRy+LfZbEZt10artNGkpw7x8c9P3yMBrQiLEGv22ncQ@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]> Applied to `rust-fixes` -- thanks everyone! [ 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: https://github.com/rust-lang/rust/pull/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: https://github.com/rust-lang/rust/pull/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 ] [ Fixed typo. ] Cc: [email protected] # Needed in 6.18.y and later. Cheers, Miguel