aboutsummaryrefslogtreecommitdiff
path: root/rust/kernel/prelude.rs
diff options
context:
space:
mode:
authorBenno Lossin <[email protected]>2023-08-14 08:46:41 +0000
committerMiguel Ojeda <[email protected]>2023-08-21 14:31:48 +0200
commit071cedc84e907f6984b3de3285ec2b077d3c3cdb (patch)
treeee2ef5892e8c925df4f1b16df99527c5c564aab3 /rust/kernel/prelude.rs
parentf8badd150763ae0f9c8482fabe0fdbac81735d34 (diff)
rust: add derive macro for `Zeroable`
Add a derive proc-macro for the `Zeroable` trait. The macro supports structs where every field implements the `Zeroable` trait. This way `unsafe` implementations can be avoided. The macro is split into two parts: - a proc-macro to parse generics into impl and ty generics, - a declarative macro that expands to the impl block. Suggested-by: Asahi Lina <[email protected]> Signed-off-by: Benno Lossin <[email protected]> Reviewed-by: Gary Guo <[email protected]> Reviewed-by: Martin Rodriguez Reboredo <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Added `ignore` to the `lib.rs` example and cleaned trivial nit. ] Signed-off-by: Miguel Ojeda <[email protected]>
Diffstat (limited to 'rust/kernel/prelude.rs')
-rw-r--r--rust/kernel/prelude.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/rust/kernel/prelude.rs b/rust/kernel/prelude.rs
index c28587d68ebc..ae21600970b3 100644
--- a/rust/kernel/prelude.rs
+++ b/rust/kernel/prelude.rs
@@ -18,7 +18,7 @@ pub use core::pin::Pin;
pub use alloc::{boxed::Box, vec::Vec};
#[doc(no_inline)]
-pub use macros::{module, pin_data, pinned_drop, vtable};
+pub use macros::{module, pin_data, pinned_drop, vtable, Zeroable};
pub use super::build_assert;