Re: [PATCH 15/22] rust: make pin-init its own crate
From: Andreas Hindborg
Date: Wed Mar 05 2025 - 07:13:15 EST
"Benno Lossin" <benno.lossin@xxxxxxxxx> writes:
> 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.
>
> Signed-off-by: Benno Lossin <benno.lossin@xxxxxxxxx>
> ---
[...]
> diff --git a/rust/macros/lib.rs b/rust/macros/lib.rs
> index 7ff82c82ce0c..8e116e266524 100644
> --- a/rust/macros/lib.rs
> +++ b/rust/macros/lib.rs
> @@ -2,23 +2,20 @@
>
> //! Crate for all kernel procedural macros.
>
> +#![feature(lint_reasons)]
Commit message should probably say something about this.
> +
> // When fixdep scans this, it will find this string `CONFIG_RUSTC_VERSION_TEXT`
> // and thus add a dependency on `include/config/RUSTC_VERSION_TEXT`, which is
> // touched by Kconfig when the version string from the compiler changes.
>
> #[macro_use]
> +#[expect(unused_macros)]
> mod quote;
> mod concat_idents;
> 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;
>
> @@ -374,5 +371,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 cdf94f4982df..bdd94c79b0d4 100644
> --- a/rust/macros/module.rs
> +++ b/rust/macros/module.rs
> @@ -236,7 +236,7 @@ impl kernel::ModuleMetadata for {type_} {{
> 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 33a199e4f176..11d241b85ac3 100644
> --- a/rust/macros/quote.rs
> +++ b/rust/macros/quote.rs
> @@ -2,6 +2,7 @@
>
> use proc_macro::{TokenStream, TokenTree};
>
> +#[allow(dead_code)]
#[expect(dead_code)] ?
Best regards,
Andreas Hindborg