]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: zerocopy: update to v0.8.52
authorMiguel Ojeda <ojeda@kernel.org>
Thu, 25 Jun 2026 23:19:19 +0000 (01:19 +0200)
committerMiguel Ojeda <ojeda@kernel.org>
Sat, 11 Jul 2026 11:45:46 +0000 (13:45 +0200)
Update our vendored copy of `zerocopy` (and `zerocopy-derive`) to v0.8.52.

Most SPDX identifiers have been added upstream at our request [1]
(without parentheses -- supporting them is an issue on the kernel side,
but it does already reduce our differences). The CSS one for `rustdoc`
was added too [2], but will be picked up in a later version.

For `zerocopy`, enable `--cfg no_fp_fmt_parse`, which was added at our
request to avoid our local workaround [3]. This means one less difference,
thus indicate so in our `README.md`.

For `zerocopy-derive`, enable `--cfg zerocopy_unstable_linux`. This
allows us to use `#[derive(zerocopy_derive::most_traits)]`, a new feature
upstream added for us [4]. We noticed a minor doc render bug [5], which
will be fixed for a future version too.

The following script may be used to check for the remaining differences:

    for path in $(cd rust/zerocopy-derive/ && find . -type f ! -name README.md); do
        curl --silent --show-error --location \
            https://github.com/google/zerocopy/raw/v0.8.52/zerocopy/zerocopy-derive/src/$path |
            git diff --no-index - rust/zerocopy-derive/$path &&
            echo $path: OK
    done

    for path in $(cd rust/zerocopy/ && find . -type f ! -name README.md); do
        curl --silent --show-error --location \
            https://github.com/google/zerocopy/raw/v0.8.52/zerocopy/$path |
            git diff --no-index - rust/zerocopy/$path &&
            echo $path: OK
    done

Cc: Joshua Liebow-Feeser <joshlf@google.com>
Cc: Jack Wrenn <jswrenn@google.com>
Link: https://github.com/google/zerocopy/issues/3428
Link: https://github.com/google/zerocopy/issues/3457
Link: https://github.com/google/zerocopy/issues/3426
Link: https://github.com/google/zerocopy/pull/3416
Link: https://github.com/google/zerocopy/issues/3466
Acked-by: Nicolas Schier <n.schier@fritz.com>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260625231919.692444-1-ojeda@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
31 files changed:
rust/Makefile
rust/zerocopy-derive/README.md
rust/zerocopy-derive/derive/from_bytes.rs
rust/zerocopy-derive/derive/into_bytes.rs
rust/zerocopy-derive/derive/known_layout.rs
rust/zerocopy-derive/derive/mod.rs
rust/zerocopy-derive/derive/try_from_bytes.rs
rust/zerocopy-derive/derive/unaligned.rs
rust/zerocopy-derive/lib.rs
rust/zerocopy-derive/repr.rs
rust/zerocopy-derive/util.rs
rust/zerocopy/README.md
rust/zerocopy/src/byte_slice.rs
rust/zerocopy/src/byteorder.rs
rust/zerocopy/src/deprecated.rs
rust/zerocopy/src/error.rs
rust/zerocopy/src/impls.rs
rust/zerocopy/src/layout.rs
rust/zerocopy/src/lib.rs
rust/zerocopy/src/macros.rs
rust/zerocopy/src/pointer/inner.rs
rust/zerocopy/src/pointer/invariant.rs
rust/zerocopy/src/pointer/mod.rs
rust/zerocopy/src/pointer/ptr.rs
rust/zerocopy/src/pointer/transmute.rs
rust/zerocopy/src/ref.rs
rust/zerocopy/src/split_at.rs
rust/zerocopy/src/util/macro_util.rs
rust/zerocopy/src/util/macros.rs
rust/zerocopy/src/util/mod.rs
rust/zerocopy/src/wrappers.rs

index a870d1616c71159e54b0cc4f59f5a006f800b48c..835cf10e1c0b07767e3f85b0aeb9ed8c9fb6685c 100644 (file)
@@ -84,11 +84,15 @@ core-flags := \
     --edition=$(core-edition) \
     $(call cfgs-to-flags,$(core-cfgs))
 
+zerocopy-cfgs := \
+    no_fp_fmt_parse
+
 zerocopy-flags := \
-    --cap-lints=allow
+    --cap-lints=allow \
+    $(call cfgs-to-flags,$(zerocopy-cfgs))
 
 zerocopy-envs := \
-    CARGO_PKG_VERSION=0.8.50
+    CARGO_PKG_VERSION=0.8.52
 
 proc_macro2-cfgs := \
     feature="proc-macro" \
@@ -128,11 +132,15 @@ syn-flags := \
     --extern quote \
     $(call cfgs-to-flags,$(syn-cfgs))
 
+zerocopy_derive-cfgs := \
+    zerocopy_unstable_linux
+
 zerocopy_derive-flags := \
     --cap-lints=allow \
     --extern proc_macro2 \
     --extern quote \
-    --extern syn
+    --extern syn \
+    $(call cfgs-to-flags,$(zerocopy_derive-cfgs))
 
 pin_init_internal-cfgs := \
     kernel USE_RUSTC_FEATURES
@@ -644,9 +652,11 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L
 rust-analyzer:
        $(Q)MAKEFLAGS= $(srctree)/scripts/generate_rust_analyzer.py \
                --cfgs='core=$(core-cfgs)' $(core-edition) \
+               --cfgs='zerocopy=$(zerocopy-cfgs)' \
                --cfgs='proc_macro2=$(proc_macro2-cfgs)' \
                --cfgs='quote=$(quote-cfgs)' \
                --cfgs='syn=$(syn-cfgs)' \
+               --cfgs='zerocopy_derive=$(zerocopy_derive-cfgs)' \
                --cfgs='pin_init_internal=$(pin_init_internal-cfgs)' \
                --cfgs='pin_init=$(pin_init-cfgs)' \
                --envs='zerocopy=$(zerocopy-envs)' \
index 110f4a40177835b2dacb2de14e52d767c63576c2..2a3dcf1212aff079f70212e4b7d1ab4762cc923f 100644 (file)
@@ -1,14 +1,14 @@
 # `zerocopy-derive`
 
-These source files come from the Rust `zerocopy-derive` crate, version v0.8.50
-(released 2026-05-31), hosted in the <https://github.com/google/zerocopy>
+These source files come from the Rust `zerocopy-derive` crate, version v0.8.52
+(released 2026-06-09), hosted in the <https://github.com/google/zerocopy>
 repository, licensed under "BSD-2-Clause OR Apache-2.0 OR MIT" and only
-modified to add the SPDX license identifiers and to remove the generation of
+modified to tweak the SPDX license identifiers and to remove the generation of
 non-ASCII identifiers.
 
 For copyright details, please see:
 
-    https://github.com/google/zerocopy/blob/v0.8.50/README.md?plain=1
-    https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-BSD
-    https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-APACHE
-    https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-MIT
+    https://github.com/google/zerocopy/blob/v0.8.52/README.md?plain=1
+    https://github.com/google/zerocopy/blob/v0.8.52/LICENSE-BSD
+    https://github.com/google/zerocopy/blob/v0.8.52/LICENSE-APACHE
+    https://github.com/google/zerocopy/blob/v0.8.52/LICENSE-MIT
index d693a63b7645171c338e17d30f3f50e0e139bb8f..66d820f6ad4cde3f0703422928abfe01166256c8 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 use proc_macro2::{Span, TokenStream};
 use syn::{
     parse_quote, Data, DataEnum, DataStruct, DataUnion, Error, Expr, ExprLit, ExprUnary, Lit, UnOp,
index ad52a6b45d288d9555dde49d44f9da0a1a4e6d89..0103a78d087f7c134cfc31cd2b1d59a80f03c8ab 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 use proc_macro2::{Span, TokenStream};
 use quote::quote;
 use syn::{Data, DataEnum, DataStruct, DataUnion, Error, Type};
index fddffd167c827f402cc88451a4acbdc62dcf63e9..d0c4cecfff151e78e5c43002fac82004a4cf1ffa 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 use proc_macro2::TokenStream;
 use quote::quote;
 use syn::{parse_quote, Data, Error, Type};
@@ -87,7 +87,6 @@ fn derive_known_layout_for_repr_c_struct<'a>(
     };
 
     let inner_extras = {
-        let leading_fields_tys = leading_fields_tys.clone();
         let methods = make_methods(*trailing_field_ty);
         let (_, ty_generics, _) = ctx.ast.generics.split_for_impl();
 
index 665ba7da55a8013c4f863a4b15dfb1f6474de9cd..b3839fcf73c9727d79829555b309a4459e6c3c91 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 pub mod from_bytes;
 pub mod into_bytes;
 pub mod known_layout;
@@ -15,8 +15,8 @@ use crate::{
     util::{Ctx, DataExt, FieldBounds, ImplBlockBuilder, Trait},
 };
 
-pub(crate) fn derive_immutable(ctx: &Ctx, _top_level: Trait) -> TokenStream {
-    match &ctx.ast.data {
+pub(crate) fn derive_immutable(ctx: &Ctx, _top_level: Trait) -> Result<TokenStream, Error> {
+    Ok(match &ctx.ast.data {
         Data::Struct(strct) => {
             ImplBlockBuilder::new(ctx, strct, Trait::Immutable, FieldBounds::ALL_SELF).build()
         }
@@ -26,7 +26,7 @@ pub(crate) fn derive_immutable(ctx: &Ctx, _top_level: Trait) -> TokenStream {
         Data::Union(unn) => {
             ImplBlockBuilder::new(ctx, unn, Trait::Immutable, FieldBounds::ALL_SELF).build()
         }
-    }
+    })
 }
 
 pub(crate) fn derive_hash(ctx: &Ctx, _top_level: Trait) -> Result<TokenStream, Error> {
@@ -97,16 +97,20 @@ pub(crate) fn derive_split_at(ctx: &Ctx, _top_level: Trait) -> Result<TokenStrea
     match &ctx.ast.data {
         Data::Struct(_) => {}
         Data::Enum(_) | Data::Union(_) => {
-            return Err(Error::new(Span::call_site(), "can only be applied to structs"));
+            return ctx
+                .error_or_skip(Error::new(Span::call_site(), "can only be applied to structs"));
         }
     };
 
     if repr.get_packed().is_some() {
-        return Err(Error::new(Span::call_site(), "must not have #[repr(packed)] attribute"));
+        return ctx.error_or_skip(Error::new(
+            Span::call_site(),
+            "must not have #[repr(packed)] attribute",
+        ));
     }
 
     if !(repr.is_c() || repr.is_transparent()) {
-        return Err(Error::new(
+        return ctx.error_or_skip(Error::new(
             Span::call_site(),
             "must have #[repr(C)] or #[repr(transparent)] in order to guarantee this type's layout is splitable",
         ));
@@ -116,7 +120,7 @@ pub(crate) fn derive_split_at(ctx: &Ctx, _top_level: Trait) -> Result<TokenStrea
     let trailing_field = if let Some(((_, _, trailing_field), _)) = fields.split_last() {
         trailing_field
     } else {
-        return Err(Error::new(Span::call_site(), "must at least one field"));
+        return ctx.error_or_skip(Error::new(Span::call_site(), "must at least one field"));
     };
 
     let zerocopy_crate = &ctx.zerocopy_crate;
index a3e4a75631a5c79cdbff490bb12d3f89c7a7db8d..44f0833287864132b04c5b4cfe92cf89ec8c1bd3 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 use proc_macro2::TokenStream;
 use quote::quote;
 use syn::{
@@ -531,8 +531,8 @@ fn derive_has_field_struct_union(ctx: &Ctx, data: &dyn DataExt) -> TokenStream {
                 data,
                 Trait::ProjectField {
                     variant_id: variant_id.clone(),
-                    field: field.clone(),
-                    field_id: field_id.clone(),
+                    field,
+                    field_id,
                     invariants: parse_quote!((Aliasing, Alignment, #zerocopy_crate::invariant::Initialized)),
                 },
                 FieldBounds::None,
index d6dea0a11f1ebd2b53feb0c1f4bd2660ee942e3d..7c97d62e2dcb5551254a87b1b34cc1c50a37af72 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 use proc_macro2::{Span, TokenStream};
 use syn::{Data, DataEnum, DataStruct, DataUnion, Error};
 
index c517ea7db1eb1f108799ea8bab48a8dfd1f3b68d..88599e7508942f3685067ddaf496f824249f17ee 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2019 The Fuchsia Authors
 //
 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
@@ -129,6 +129,40 @@ derive!(ByteHash => derive_hash => crate::derive::derive_hash);
 derive!(ByteEq => derive_eq => crate::derive::derive_eq);
 derive!(SplitAt => derive_split_at => crate::derive::derive_split_at);
 
+#[cfg_attr(zerocopy_unstable_linux, doc(hidden))]
+#[proc_macro_derive(most_traits, attributes(zerocopy))]
+pub fn most_traits(ts: proc_macro::TokenStream) -> proc_macro::TokenStream {
+    let ast = syn::parse_macro_input!(ts as DeriveInput);
+    let ctx = match Ctx::try_from_derive_input(ast) {
+        Ok(ctx) => ctx,
+        Err(e) => return e.into_compile_error().into(),
+    }
+    .skip_on_error();
+
+    // top-level traits for which to attempt a derive
+    let derives: [(fn(&Ctx, Trait) -> _, _); 6] = [
+        (crate::derive::known_layout::derive, Trait::KnownLayout),
+        (crate::derive::derive_immutable, Trait::Immutable),
+        (crate::derive::from_bytes::derive_from_bytes, Trait::FromBytes),
+        (crate::derive::into_bytes::derive_into_bytes, Trait::IntoBytes),
+        (crate::derive::derive_split_at, Trait::SplitAt),
+        (crate::derive::unaligned::derive_unaligned, Trait::Unaligned),
+    ];
+
+    let mut tokens = proc_macro2::TokenStream::new();
+    for (derive, t) in derives {
+        tokens.extend(derive(&ctx, t))
+    }
+
+    // We wrap in `const_block` as a backstop in case any derive fails
+    // to wrap its output in `const_block` (and thus fails to annotate)
+    // with the full set of `#[allow(...)]` attributes).
+    let ts = const_block([Some(tokens)]);
+    #[cfg(test)]
+    crate::util::testutil::check_hygiene(ts.clone());
+    ts.into()
+}
+
 /// Deprecated: prefer [`FromZeros`] instead.
 #[deprecated(since = "0.8.0", note = "`FromZeroes` was renamed to `FromZeros`")]
 #[doc(hidden)]
index 74fd376d9fdabef8f6e13f909c2b03c13fc012d9..1525e94302d1b2536574475fa28fde2bba7a7c15 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2019 The Fuchsia Authors
 //
 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
index 5ba5228e2a44fc23067ef257a7b8eda2ae058c30..5c5e9d3bdcb8f921b10ed0146f0ad8be20e26f2b 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2019 The Fuchsia Authors
 //
 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
@@ -98,6 +98,11 @@ impl Ctx {
         }
     }
 
+    pub(crate) fn skip_on_error(mut self) -> Self {
+        self.skip_on_error = true;
+        self
+    }
+
     pub(crate) fn core_path(&self) -> TokenStream {
         let zerocopy_crate = &self.zerocopy_crate;
         quote!(#zerocopy_crate::util::macro_util::core_reexport)
@@ -106,20 +111,21 @@ impl Ctx {
     pub(crate) fn cfg_compile_error(&self) -> TokenStream {
         // By checking both during the compilation of the proc macro *and* in
         // the generated code, we ensure that `--cfg
-        // zerocopy_unstable_derive_on_error` need only be passed *either* when
+        // zerocopy_unstable_linux` need only be passed *either* when
         // compiling this crate *or* when compiling the user's crate. The former
         // is preferable, but in some situations (such as when cross-compiling
         // using `cargo build --target`), it doesn't get propagated to this
         // crate's build by default.
-        if cfg!(zerocopy_unstable_derive_on_error) {
+        if cfg!(zerocopy_unstable_linux) {
             quote!()
         } else if let Some(span) = self.on_error_span {
             let core = self.core_path();
-            let error_message = "`on_error` is experimental; pass '--cfg zerocopy_unstable_derive_on_error' to enable";
+            let error_message =
+                "`on_error` is experimental; pass '--cfg zerocopy_unstable_linux' to enable";
             quote::quote_spanned! {span=>
                 #[allow(unused_attributes, unexpected_cfgs)]
                 const _: () = {
-                    #[cfg(not(zerocopy_unstable_derive_on_error))]
+                    #[cfg(not(zerocopy_unstable_linux))]
                     #core::compile_error!(#error_message);
                 };
             }
@@ -612,6 +618,20 @@ impl<'a> ImplBlockBuilder<'a> {
             }
         };
 
+        let zerocopy_bounds =
+            field_type_bounds
+                .into_iter()
+                .chain(padding_check_bound)
+                .chain(self_bounds)
+                .map(|bound| {
+                    if self.ctx.skip_on_error {
+                        parse_quote!(for<'zc> #bound)
+                    } else {
+                        bound.clone()
+                    }
+                })
+                .collect::<Vec<_>>();
+
         let bounds = self
             .ctx
             .ast
@@ -621,9 +641,7 @@ impl<'a> ImplBlockBuilder<'a> {
             .map(|where_clause| where_clause.predicates.iter())
             .into_iter()
             .flatten()
-            .chain(field_type_bounds.iter())
-            .chain(padding_check_bound.iter())
-            .chain(self_bounds.iter());
+            .chain(zerocopy_bounds.iter());
 
         // The parameters with trait bounds, but without type defaults.
         let mut params: Vec<_> = self
index 99e6cad0e26cac0054e51f7436763fd3003fb20b..712b0317df25e042b179f707b506ecb5f9b95d9a 100644 (file)
@@ -1,14 +1,13 @@
 # `zerocopy`
 
-These source files come from the Rust `zerocopy` crate, version v0.8.50
-(released 2026-05-31), hosted in the <https://github.com/google/zerocopy>
+These source files come from the Rust `zerocopy` crate, version v0.8.52
+(released 2026-06-09), hosted in the <https://github.com/google/zerocopy>
 repository, licensed under "BSD-2-Clause OR Apache-2.0 OR MIT" and only
-modified to add the SPDX license identifiers and to remove `Display`
-for `f32` and `f64`.
+modified to tweak the SPDX license identifiers.
 
 For copyright details, please see:
 
-    https://github.com/google/zerocopy/blob/v0.8.50/README.md?plain=1
-    https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-BSD
-    https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-APACHE
-    https://github.com/google/zerocopy/blob/v0.8.50/LICENSE-MIT
+    https://github.com/google/zerocopy/blob/v0.8.52/README.md?plain=1
+    https://github.com/google/zerocopy/blob/v0.8.52/LICENSE-BSD
+    https://github.com/google/zerocopy/blob/v0.8.52/LICENSE-APACHE
+    https://github.com/google/zerocopy/blob/v0.8.52/LICENSE-MIT
index a5ded4a18b3978ff2023cbcbad6ab00743f2e6f4..b7f85098dbc4c03a9006789efcd828407eb80f38 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2024 The Fuchsia Authors
 //
 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
index 8f70048f1eb03d4f63b875c89190b6b84be21c34..ecf95e38eebdb7202e41359900e3a0610980ec8a 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2019 The Fuchsia Authors
 //
 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
@@ -164,6 +164,42 @@ pub type BE = BigEndian;
 /// A type alias for [`LittleEndian`].
 pub type LE = LittleEndian;
 
+macro_rules! impl_dbg_trait {
+    ($name:ident, $native:ident) => {
+        impl<O: ByteOrder> Debug for $name<O> {
+            #[inline]
+            fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
+                // This results in a format like "U16(42)".
+                f.debug_tuple(stringify!($name)).field(&self.get()).finish()
+            }
+        }
+    };
+}
+
+macro_rules! impl_dbg_traits {
+    ($name:ident, $native:ident, "floating point number") => {
+        #[cfg(not(no_fp_fmt_parse))]
+        impl_dbg_trait!($name, $native);
+
+        #[cfg(no_fp_fmt_parse)]
+        impl<O: ByteOrder> Debug for $name<O> {
+            #[inline]
+            fn fmt(&self, _f: &mut Formatter<'_>) -> fmt::Result {
+                panic!("floating point support is turned off");
+            }
+        }
+    };
+    ($name:ident, $native:ident, "unsigned integer") => {
+        impl_dbg_traits!($name, $native, @all_types);
+    };
+    ($name:ident, $native:ident, "signed integer") => {
+        impl_dbg_traits!($name, $native, @all_types);
+    };
+    ($name:ident, $native:ident, @all_types) => {
+        impl_dbg_trait!($name, $native);
+    };
+}
+
 macro_rules! impl_fmt_trait {
     ($name:ident, $native:ident, $trait:ident) => {
         impl<O: ByteOrder> $trait for $name<O> {
@@ -177,6 +213,8 @@ macro_rules! impl_fmt_trait {
 
 macro_rules! impl_fmt_traits {
     ($name:ident, $native:ident, "floating point number") => {
+        #[cfg(not(no_fp_fmt_parse))]
+        impl_fmt_trait!($name, $native, Display);
     };
     ($name:ident, $native:ident, "unsigned integer") => {
         impl_fmt_traits!($name, $native, @all_types);
@@ -687,16 +725,9 @@ example of how it can be used for parsing UDP packets.
             }
         }
 
+        impl_dbg_traits!($name, $native, $number_kind);
         impl_fmt_traits!($name, $native, $number_kind);
         impl_ops_traits!($name, $native, $number_kind);
-
-        impl<O: ByteOrder> Debug for $name<O> {
-            #[inline]
-            fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
-                // This results in a format like "U16(42)".
-                f.debug_tuple(stringify!($name)).field(&self.get()).finish()
-            }
-        }
     };
 }
 
index 24bafbf9adebeb5adb29a234dee14b3a28893b6c..59ddd35c77c6a5405c5b9d7607e7ac9506019f4a 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2024 The Fuchsia Authors
 //
 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
index 7cb08c31d452cc82d1870bfa1462a5cd616965f3..5eb30de934f38ed451da1b8b1ecc4617775f58ca 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2024 The Fuchsia Authors
 //
 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
index 22fd6c3d5d9409b4f217f13886450eac211527b3..62e234c5202b58948fba01ec6691e4195e12deb4 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2024 The Fuchsia Authors
 //
 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
@@ -1359,7 +1359,7 @@ mod simd {
         #[cfg(not(no_zerocopy_aarch64_simd_1_59_0))]
         simd_arch_mod!(
             #[cfg(all(
-                target_arch = "aarch64", 
+                target_arch = "aarch64",
                 any(
                     target_endian = "little",
                     not(no_zerocopy_aarch64_simd_be_1_87_0)
index 6015d0f2de52adc3c0d3c726af3e4b9b6fde1cd4..942d35db895726c7b4695710f881ed0be4551bff 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2024 The Fuchsia Authors
 //
 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
index 3302d67602abd6637a66e39789974c13a2a98a51..700fece1b728f3f1d48f54af9d52a36d72ac261a 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2018 The Fuchsia Authors
 //
 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
@@ -12,7 +12,7 @@
 // After updating the following doc comment, make sure to run the following
 // command to update `README.md` based on its contents:
 //
-//   cargo -q run --manifest-path tools/Cargo.toml -p generate-readme > README.md
+//   (cd .. && cargo -q run --manifest-path tools/Cargo.toml -p generate-readme) > README.md
 
 //! ***<span style="font-size: 140%">Fast, safe, <span
 //! style="color:red;">compile error</span>. Pick two.</span>***
 //!
 //! [Miri]: https://github.com/rust-lang/miri
 //! [Kani]: https://github.com/model-checking/kani
-//! [soundness policy]: https://github.com/google/zerocopy/blob/main/POLICIES.md#soundness
+//! [soundness policy]: https://github.com/google/zerocopy/blob/main/zerocopy/POLICIES.md#soundness
 //!
 //! # Relationship to Project Safe Transmute
 //!
 //!
 //! See our [MSRV policy].
 //!
-//! [MSRV policy]: https://github.com/google/zerocopy/blob/main/POLICIES.md#msrv
+//! [MSRV policy]: https://github.com/google/zerocopy/blob/main/zerocopy/POLICIES.md#msrv
 //!
 //! # Changelog
 //!
@@ -435,6 +435,9 @@ const _: () = {
     WARNING
 };
 
+#[doc(hidden)]
+#[cfg(all(any(feature = "derive", test), zerocopy_unstable_linux))]
+pub use zerocopy_derive::most_traits;
 /// Implements [`KnownLayout`].
 ///
 /// This derive analyzes various aspects of a type's layout that are needed for
@@ -2832,7 +2835,7 @@ pub unsafe trait TryFromBytes {
     /// ```
     ///
     /// [`try_mut_from_bytes`]: TryFromBytes::try_mut_from_bytes
-    ///  
+    ///
     #[doc = codegen_header!("h5", "try_mut_from_bytes_with_elems")]
     ///
     /// See [`TryFromBytes::try_ref_from_bytes_with_elems`](#method.try_ref_from_bytes_with_elems.codegen).
index b801d86a8fa63e31f242b2b3ab8f16299ecdae67..ec67c03a44fc4db1b70107bdeda1a7b09034d9ff 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2024 The Fuchsia Authors
 //
 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
index 5db08080141fa4d35f966467fae488c02a23e028..949b60a3f83eae9e882ff1319504bfb53409cde8 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2024 The Fuchsia Authors
 //
 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
index 1802d23563db8c47b8a089efe805aa15bd28a4f5..7ff0d43dad5e896555720254e4182799c1e7bc2d 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2024 The Fuchsia Authors
 //
 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
index 3461f7f5ca80e64316d350aa73b71762c93f2cf2..d6eacc52febe2eb01c11e7dfe55fee795c62604e 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2023 The Fuchsia Authors
 //
 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
index b7c4ea56d2b2c16b5b58d048e49063a05bdd9eb6..7213f6f4a04ee8c662edebbd389e3674feda14e0 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2023 The Fuchsia Authors
 //
 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
index a534984b70d30a303e64ab6f0332381ce43735f9..ef9836698203a26d1dbdd4d9fdb80729f5a84245 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2025 The Fuchsia Authors
 //
 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
index 860066d7519628d9bcc38c9ae6357c96646ac8ff..e49f2a887ffa7496c888ba55e9d2596a768703e5 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2024 The Fuchsia Authors
 //
 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
index 9a67d5acbb0d7bc9f39015871984a88e93229420..d7778425a31d3ce273135285d984e130a9740ab0 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2025 The Fuchsia Authors
 //
 // Licensed under the 2-Clause BSD License <LICENSE-BSD or
index 1abb0fbeb46e621c0206085c13fad123ab3ec260..ceeb80432b0ba8f127d08d3d284dedd2e16b2bf4 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2022 The Fuchsia Authors
 //
 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
index 43e4fd64ee1588952d8e57d67e02b97d022ce9ca..7e63e3a54fc41edb8ae5eaff0c5620e46cd890c9 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2023 The Fuchsia Authors
 //
 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
index d6d4c6c2fcd9a08641ead9291b3fee3f03e12b2f..f8affbbd336cfaae6d326fb171f9b0f06226f7ec 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2023 The Fuchsia Authors
 //
 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0
index 266aec25fa580905d37ebe464574f4dacdc8eb1e..1a8cf2b41d5553daa56a1d6c7a8bd5e69580102b 100644 (file)
@@ -1,5 +1,5 @@
 // SPDX-License-Identifier: (BSD-2-Clause OR Apache-2.0) OR MIT
-
+//
 // Copyright 2023 The Fuchsia Authors
 //
 // Licensed under a BSD-style license <LICENSE-BSD>, Apache License, Version 2.0