From 6619b881b38842ea0d7dee7f9620321b6108d215 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Wed, 14 Jan 2026 21:47:02 +0100 Subject: [PATCH] Assert STORE_PATH_HASH_SIZE matches C struct `zerocopy` is safe enough, but it's good to be explicit about this. --- nix-bindings-store/src/path.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nix-bindings-store/src/path.rs b/nix-bindings-store/src/path.rs index e3be645..41f7f5b 100644 --- a/nix-bindings-store/src/path.rs +++ b/nix-bindings-store/src/path.rs @@ -12,6 +12,9 @@ use nix_bindings_util::{ /// The size of a store path hash in bytes (20 bytes, decoded from nix32). pub const STORE_PATH_HASH_SIZE: usize = 20; +#[cfg(nix_at_least = "2.33")] +const _: () = assert!(std::mem::size_of::() == STORE_PATH_HASH_SIZE); + pub struct StorePath { raw: NonNull, }