Commit a9fa3a9c authored by Benno Lossin's avatar Benno Lossin Committed by Miguel Ojeda
Browse files

rust: pin-init: miscellaneous synchronization with the user-space version



Remove the last differences between the kernel version and the
user-space version.

Signed-off-by: default avatarBenno Lossin <benno.lossin@proton.me>
Reviewed-by: default avatarAndreas Hindborg <a.hindborg@kernel.org>
Tested-by: default avatarAndreas Hindborg <a.hindborg@kernel.org>
Reviewed-by: default avatarFiona Behrens <me@kloenk.dev>
Link: https://lore.kernel.org/r/20250308110339.2997091-20-benno.lossin@proton.me


Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
parent 7cb5dee4
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@
//
// Remove once we have `proc_macro2` in the kernel.
#![allow(clippy::useless_conversion)]
// Documentation is done in the pin-init crate instead.
#![allow(missing_docs)]

use proc_macro::TokenStream;

@@ -30,19 +32,16 @@
mod pinned_drop;
mod zeroable;

#[allow(missing_docs)]
#[proc_macro_attribute]
pub fn pin_data(inner: TokenStream, item: TokenStream) -> TokenStream {
    pin_data::pin_data(inner.into(), item.into()).into()
}

#[allow(missing_docs)]
#[proc_macro_attribute]
pub fn pinned_drop(args: TokenStream, input: TokenStream) -> TokenStream {
    pinned_drop::pinned_drop(args.into(), input.into()).into()
}

#[allow(missing_docs)]
#[proc_macro_derive(Zeroable)]
pub fn derive_zeroable(input: TokenStream) -> TokenStream {
    zeroable::derive(input.into()).into()
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
///
/// [nomicon]: https://doc.rust-lang.org/nomicon/subtyping.html
/// [this table]: https://doc.rust-lang.org/nomicon/phantom-data.html#table-of-phantomdata-patterns
pub(super) type Invariant<T> = PhantomData<fn(*mut T) -> *mut T>;
pub(crate) type Invariant<T> = PhantomData<fn(*mut T) -> *mut T>;

/// Module-internal type implementing `PinInit` and `Init`.
///
+0 −2
Original line number Diff line number Diff line
@@ -349,8 +349,6 @@
///     }
/// }
/// ```
///
/// [`pin_init!`]: crate::pin_init
pub use ::pin_init_internal::pin_data;

/// Used to implement `PinnedDrop` safely.