Skip to content

Commit aeebcfa

Browse files
Darksonngregkh
authored andcommitted
rust: device: avoid trailing ; in printing macros
commit a19bda8 upstream. 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> [ Resolved conflict on `dev_printk` by not performing a similar cleanup since it is not strictly needed. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e94e820 commit aeebcfa

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

rust/kernel/device.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ macro_rules! dev_printk {
625625
/// ```
626626
#[macro_export]
627627
macro_rules! dev_emerg {
628-
($($f:tt)*) => { $crate::dev_printk!(pr_emerg, $($f)*); }
628+
($($f:tt)*) => { $crate::dev_printk!(pr_emerg, $($f)*) }
629629
}
630630

631631
/// Prints an alert-level message (level 1) prefixed with device information.
@@ -651,7 +651,7 @@ macro_rules! dev_emerg {
651651
/// ```
652652
#[macro_export]
653653
macro_rules! dev_alert {
654-
($($f:tt)*) => { $crate::dev_printk!(pr_alert, $($f)*); }
654+
($($f:tt)*) => { $crate::dev_printk!(pr_alert, $($f)*) }
655655
}
656656

657657
/// Prints a critical-level message (level 2) prefixed with device information.
@@ -677,7 +677,7 @@ macro_rules! dev_alert {
677677
/// ```
678678
#[macro_export]
679679
macro_rules! dev_crit {
680-
($($f:tt)*) => { $crate::dev_printk!(pr_crit, $($f)*); }
680+
($($f:tt)*) => { $crate::dev_printk!(pr_crit, $($f)*) }
681681
}
682682

683683
/// Prints an error-level message (level 3) prefixed with device information.
@@ -703,7 +703,7 @@ macro_rules! dev_crit {
703703
/// ```
704704
#[macro_export]
705705
macro_rules! dev_err {
706-
($($f:tt)*) => { $crate::dev_printk!(pr_err, $($f)*); }
706+
($($f:tt)*) => { $crate::dev_printk!(pr_err, $($f)*) }
707707
}
708708

709709
/// Prints a warning-level message (level 4) prefixed with device information.
@@ -729,7 +729,7 @@ macro_rules! dev_err {
729729
/// ```
730730
#[macro_export]
731731
macro_rules! dev_warn {
732-
($($f:tt)*) => { $crate::dev_printk!(pr_warn, $($f)*); }
732+
($($f:tt)*) => { $crate::dev_printk!(pr_warn, $($f)*) }
733733
}
734734

735735
/// Prints a notice-level message (level 5) prefixed with device information.
@@ -755,7 +755,7 @@ macro_rules! dev_warn {
755755
/// ```
756756
#[macro_export]
757757
macro_rules! dev_notice {
758-
($($f:tt)*) => { $crate::dev_printk!(pr_notice, $($f)*); }
758+
($($f:tt)*) => { $crate::dev_printk!(pr_notice, $($f)*) }
759759
}
760760

761761
/// Prints an info-level message (level 6) prefixed with device information.
@@ -781,7 +781,7 @@ macro_rules! dev_notice {
781781
/// ```
782782
#[macro_export]
783783
macro_rules! dev_info {
784-
($($f:tt)*) => { $crate::dev_printk!(pr_info, $($f)*); }
784+
($($f:tt)*) => { $crate::dev_printk!(pr_info, $($f)*) }
785785
}
786786

787787
/// Prints a debug-level message (level 7) prefixed with device information.
@@ -807,5 +807,5 @@ macro_rules! dev_info {
807807
/// ```
808808
#[macro_export]
809809
macro_rules! dev_dbg {
810-
($($f:tt)*) => { $crate::dev_printk!(pr_dbg, $($f)*); }
810+
($($f:tt)*) => { $crate::dev_printk!(pr_dbg, $($f)*) }
811811
}

0 commit comments

Comments
 (0)