aboutsummaryrefslogtreecommitdiffstats
path: root/rust/macros/lib.rs
diff options
context:
space:
mode:
authorIgor Korotin <[email protected]>2025-05-19 16:45:53 +0000
committerMiguel Ojeda <[email protected]>2025-05-22 22:12:14 +0000
commitde7cd3e4d6387df6a5ae8c4c32ff0479ebe0efb5 (patch)
tree75379535683cabe9d3839d4886192d549851da75 /rust/macros/lib.rs
parentrust: arm: fix unknown (to Clang) argument '-mno-fdpic' (diff)
downloadkernel-de7cd3e4d6387df6a5ae8c4c32ff0479ebe0efb5.tar.gz
kernel-de7cd3e4d6387df6a5ae8c4c32ff0479ebe0efb5.zip
rust: use absolute paths in macros referencing core and kernel
Macros and auto-generated code should use absolute paths, `::core::...` and `::kernel::...`, for core and kernel references. This prevents issues where user-defined modules named `core` or `kernel` could be picked up instead of the `core` or `kernel` crates. Thus clean some references up. Suggested-by: Benno Lossin <[email protected]> Closes: https://github.com/Rust-for-Linux/linux/issues/1150 Signed-off-by: Igor Korotin <[email protected]> Reviewed-by: Benno Lossin <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Applied `rustfmt`. Reworded slightly. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/macros/lib.rs')
-rw-r--r--rust/macros/lib.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs
index 9acaa68c974e..cb429eceff71 100644
--- a/rust/macros/lib.rs
+++ b/rust/macros/lib.rs
@@ -283,7 +283,7 @@ pub fn concat_idents(ts: TokenStream) -> TokenStream {
/// # const binder_driver_return_protocol_BR_FAILED_REPLY: u32 = 14;
/// macro_rules! pub_no_prefix {
/// ($prefix:ident, $($newname:ident),+) => {
-/// kernel::macros::paste! {
+/// ::kernel::macros::paste! {
/// $(pub(crate) const $newname: u32 = [<$prefix $newname>];)+
/// }
/// };
@@ -340,7 +340,7 @@ pub fn concat_idents(ts: TokenStream) -> TokenStream {
/// # const binder_driver_return_protocol_BR_FAILED_REPLY: u32 = 14;
/// macro_rules! pub_no_prefix {
/// ($prefix:ident, $($newname:ident),+) => {
-/// kernel::macros::paste! {
+/// ::kernel::macros::paste! {
/// $(pub(crate) const fn [<$newname:lower:span>]() -> u32 { [<$prefix $newname:span>] })+
/// }
/// };
@@ -375,7 +375,7 @@ pub fn concat_idents(ts: TokenStream) -> TokenStream {
/// ```
/// macro_rules! create_numbered_fn {
/// ($name:literal, $val:literal) => {
-/// kernel::macros::paste! {
+/// ::kernel::macros::paste! {
/// fn [<some_ $name _fn $val>]() -> u32 { $val }
/// }
/// };