Re: [PATCH] rust: zerocopy: update to v0.8.52

Nicolas Schier <[email protected]> Sat, 27 Jun 2026 09:55:12 +0200
Newsgroups org.kernel.vger.linux-kbuild,org.kernel.vger.rust-for-linux
Message-ID <aj-B4DLzEptpjeQ_@levanger>
On Fri, Jun 26, 2026 at 01:19:19AM +0200, Miguel Ojeda wrote:
> 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 <[email protected]>
> Cc: Jack Wrenn <[email protected]>
> Link: https://github.com/google/zerocopy/issues/3428 [1]
> Link: https://github.com/google/zerocopy/issues/3457 [2]
> Link: https://github.com/google/zerocopy/issues/3426 [3]
> Link: https://github.com/google/zerocopy/pull/3416 [4]
> Link: https://github.com/google/zerocopy/issues/3466 [5]
> Signed-off-by: Miguel Ojeda <[email protected]>
> ---
>  rust/Makefile                                 | 16 ++++--
>  rust/zerocopy-derive/README.md                | 14 +++---
>  rust/zerocopy-derive/derive/from_bytes.rs     |  2 +-
>  rust/zerocopy-derive/derive/into_bytes.rs     |  2 +-
>  rust/zerocopy-derive/derive/known_layout.rs   |  3 +-
>  rust/zerocopy-derive/derive/mod.rs            | 20 +++++---
>  rust/zerocopy-derive/derive/try_from_bytes.rs |  6 +--
>  rust/zerocopy-derive/derive/unaligned.rs      |  2 +-
>  rust/zerocopy-derive/lib.rs                   | 36 +++++++++++++-
>  rust/zerocopy-derive/repr.rs                  |  2 +-
>  rust/zerocopy-derive/util.rs                  | 34 ++++++++++---
>  rust/zerocopy/README.md                       | 15 +++---
>  rust/zerocopy/src/byte_slice.rs               |  2 +-
>  rust/zerocopy/src/byteorder.rs                | 49 +++++++++++++++----
>  rust/zerocopy/src/deprecated.rs               |  2 +-
>  rust/zerocopy/src/error.rs                    |  2 +-
>  rust/zerocopy/src/impls.rs                    |  4 +-
>  rust/zerocopy/src/layout.rs                   |  2 +-
>  rust/zerocopy/src/lib.rs                      | 13 +++--
>  rust/zerocopy/src/macros.rs                   |  2 +-
>  rust/zerocopy/src/pointer/inner.rs            |  2 +-
>  rust/zerocopy/src/pointer/invariant.rs        |  2 +-
>  rust/zerocopy/src/pointer/mod.rs              |  2 +-
>  rust/zerocopy/src/pointer/ptr.rs              |  2 +-
>  rust/zerocopy/src/pointer/transmute.rs        |  2 +-
>  rust/zerocopy/src/ref.rs                      |  2 +-
>  rust/zerocopy/src/split_at.rs                 |  2 +-
>  rust/zerocopy/src/util/macro_util.rs          |  2 +-
>  rust/zerocopy/src/util/macros.rs              |  2 +-
>  rust/zerocopy/src/util/mod.rs                 |  2 +-
>  rust/zerocopy/src/wrappers.rs                 |  2 +-
>  31 files changed, 174 insertions(+), 76 deletions(-)
> 
> diff --git a/rust/Makefile b/rust/Makefile
> index a870d1616c71..835cf10e1c0b 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -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)' \

Thanks!

Acked-by: Nicolas Schier <[email protected]>