From af268d9d2e48e6baa9164e6bebf53f73799ac350 Mon Sep 17 00:00:00 2001 From: Pekka Ristola Date: Sat, 8 Nov 2025 16:07:15 +0200 Subject: [PATCH] Remove incorrect `size_t_is_usize` check Don't require that the alignment of `size_t` equals pointer size when using the `size_t_is_usize` option. The purpose of this check was to make sure that `size_t` and `uintptr_t` are the same type, but the alignment and size don't have to match for that to be true. The code still checks that `size_t` has the same size as a pointer. Clang's C API doesn't expose the target pointer alignment, so just remove the assert. Fixes https://github.com/rust-lang/rust-bindgen/issues/3312 --- bindgen/codegen/mod.rs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/bindgen/codegen/mod.rs b/bindgen/codegen/mod.rs index 382a8ed344..af2e5272e3 100644 --- a/bindgen/codegen/mod.rs +++ b/bindgen/codegen/mod.rs @@ -993,13 +993,6 @@ impl CodeGenerator for Type { layout.size, ctx.target_pointer_size(), ); - assert_eq!( - layout.align, - ctx.target_pointer_size(), - "Target platform requires `--no-size_t-is-usize`. The alignment of `{spelling}` ({}) does not match the target pointer size ({})", - layout.align, - ctx.target_pointer_size(), - ); } return; }