]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: macros: replace `kernel::c_str!` with C-Strings
authorTamir Duberstein <tamird@gmail.com>
Thu, 13 Nov 2025 22:58:29 +0000 (17:58 -0500)
committerMiguel Ojeda <ojeda@kernel.org>
Sun, 16 Nov 2025 23:59:21 +0000 (00:59 +0100)
C-String literals were added in Rust 1.77. Replace instances of
`kernel::c_str!` with C-String literals where possible.

Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
Link: https://patch.msgid.link/20251113-core-cstr-cstrings-v3-6-411b34002774@gmail.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/macros/module.rs

index 5ee54a00c0b65699596e660b2d4d60e64be2a50c..8cef6cc958b546357ec9402c126901af8bf7ad9c 100644 (file)
@@ -228,7 +228,7 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream {
             type LocalModule = {type_};
 
             impl ::kernel::ModuleMetadata for {type_} {{
-                const NAME: &'static ::kernel::str::CStr = ::kernel::c_str!(\"{name}\");
+                const NAME: &'static ::kernel::str::CStr = c\"{name}\";
             }}
 
             // Double nested modules, since then nobody can access the public items inside.