diff options
author | 2025-03-08 11:05:09 +0000 | |
---|---|---|
committer | 2025-03-16 21:59:19 +0100 | |
commit | dbd5058ba60c3499b24a7133a4e2e24dba6ea77b (patch) | |
tree | 57fb3cbeb6d77dd896e5e57defd5b358eb47fa91 /rust/macros | |
parent | rust: add pin-init crate build infrastructure (diff) | |
download | wireguard-linux-dbd5058ba60c3499b24a7133a4e2e24dba6ea77b.tar.xz wireguard-linux-dbd5058ba60c3499b24a7133a4e2e24dba6ea77b.zip |
rust: make pin-init its own crate
Rename relative paths inside of the crate to still refer to the same
items, also rename paths inside of the kernel crate and adjust the build
system to build the crate.
[ Remove the `expect` (and thus the `lint_reasons` feature) since
the tree now uses `quote!` from `rust/macros/export.rs`. Remove the
`TokenStream` import removal, since it is now used as well.
In addition, temporarily (i.e. just for this commit) use an `--extern
force:alloc` to prevent an unknown `new_uninit` error in the `rustdoc`
target. For context, please see a similar case in:
https://lore.kernel.org/lkml/20240422090644.525520-1-ojeda@kernel.org/
And adjusted the message above. - Miguel ]
Signed-off-by: Benno Lossin <benno.lossin@proton.me>
Reviewed-by: Fiona Behrens <me@kloenk.dev>
Tested-by: Andreas Hindborg <a.hindborg@kernel.org>
Link: https://lore.kernel.org/r/20250308110339.2997091-16-benno.lossin@proton.me
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to 'rust/macros')
-rw-r--r-- | rust/macros/helpers.rs | 2 | ||||
-rw-r--r-- | rust/macros/lib.rs | 8 | ||||
-rw-r--r-- | rust/macros/module.rs | 2 | ||||
-rw-r--r-- | rust/macros/quote.rs | 1 |
4 files changed, 2 insertions, 11 deletions
diff --git a/rust/macros/helpers.rs b/rust/macros/helpers.rs index 141d8476c197..a3ee27e29a6f 100644 --- a/rust/macros/helpers.rs +++ b/rust/macros/helpers.rs @@ -86,5 +86,3 @@ pub(crate) fn function_name(input: TokenStream) -> Option<Ident> { } None } - -include!("../pin-init/internal/src/helpers.rs"); diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs index ba93dd686e38..f0f8c9232748 100644 --- a/rust/macros/lib.rs +++ b/rust/macros/lib.rs @@ -13,13 +13,7 @@ mod export; mod helpers; mod module; mod paste; -#[path = "../pin-init/internal/src/pin_data.rs"] -mod pin_data; -#[path = "../pin-init/internal/src/pinned_drop.rs"] -mod pinned_drop; mod vtable; -#[path = "../pin-init/internal/src/zeroable.rs"] -mod zeroable; use proc_macro::TokenStream; @@ -398,5 +392,3 @@ pub fn paste(input: TokenStream) -> TokenStream { paste::expand(&mut tokens); tokens.into_iter().collect() } - -include!("../pin-init/internal/src/lib.rs"); diff --git a/rust/macros/module.rs b/rust/macros/module.rs index 42ed16c48b37..46f20682a7a9 100644 --- a/rust/macros/module.rs +++ b/rust/macros/module.rs @@ -244,7 +244,7 @@ pub(crate) fn module(ts: TokenStream) -> TokenStream { mod __module_init {{ mod __module_init {{ use super::super::{type_}; - use kernel::init::PinInit; + use pin_init::PinInit; /// The \"Rust loadable module\" mark. // diff --git a/rust/macros/quote.rs b/rust/macros/quote.rs index 31b7ebe504f4..92cacc4067c9 100644 --- a/rust/macros/quote.rs +++ b/rust/macros/quote.rs @@ -2,6 +2,7 @@ use proc_macro::{TokenStream, TokenTree}; +#[allow(dead_code)] pub(crate) trait ToTokens { fn to_tokens(&self, tokens: &mut TokenStream); } |