From 7c64d09a842c24a96a07645af356d5b1949b89d2 Mon Sep 17 00:00:00 2001 From: Joshua Liebow-Feeser Date: Tue, 10 Sep 2024 18:04:11 -0400 Subject: [PATCH] Add optional zerocopy crate derives --- Cargo.toml | 1 + src/lib.rs | 3 +++ src/unix/bsd/apple/b64/aarch64/mod.rs | 1 + 3 files changed, 5 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 8fe2ad6badabf..e2ce1256406d0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -132,6 +132,7 @@ cargo-args = ["-Zbuild-std=core"] [dependencies] rustc-std-workspace-core = { version = "1.0.0", optional = true } +zerocopy_0_8 = { package = "zerocopy", version = "0.8.0-alpha.21", optional = true, features = ["derive"] } [features] default = ["std"] diff --git a/src/lib.rs b/src/lib.rs index 764d8e4cd096a..5d8e7cfd2f8df 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -28,6 +28,9 @@ #![cfg_attr(feature = "rustc-dep-of-std", no_core)] #![cfg_attr(libc_const_extern_fn_unstable, feature(const_extern_fn))] +#[cfg(feature = "zerocopy_0_8")] +extern crate zerocopy_0_8 as zerocopy; + #[macro_use] mod macros; diff --git a/src/unix/bsd/apple/b64/aarch64/mod.rs b/src/unix/bsd/apple/b64/aarch64/mod.rs index 79e9ac842f9ca..ea242eab09163 100644 --- a/src/unix/bsd/apple/b64/aarch64/mod.rs +++ b/src/unix/bsd/apple/b64/aarch64/mod.rs @@ -1,6 +1,7 @@ pub type boolean_t = ::c_int; s! { + #[cfg_attr(feature = "zerocopy_0_8", derive(zerocopy_0_8::FromBytes))] pub struct malloc_zone_t { __private: [::uintptr_t; 18], // FIXME: needs arm64 auth pointers support }