rust-lang/rust-bindgen

if size_t_is_usize is set to true, and bindgen handles a size_t, and size_t ≠ uintptr_t, bindgen should abort

dkg opened this issue · 0 comments

dkg commented

Many projects (including nettle-sys, linux-kernel-module-rust, nodejs-sys, bcc-sys) are moving to revert to the pre-0.53 behavior that maps size_t and usize. These projects (and many others if #1902 is merged) will fail subtly if they use bindgen over a C API that includes size_t on a weird niche platform where size_tuintptr_t. if bindgen detects that this situation is happening, it should produce an error.

the three conditions that should produce an error (all conditions must be present) are:

  • size_t_is_usize is set to true
  • The source C API includes a size_t
  • The platform's size_t is not the same underlying type as uintptr_t

(see also #1901 and #1671 for background)