On Fri, Aug 29, 2025 at 2:00 PM brian m. carlson <sandals@xxxxxxxxxxxxxxxxxxxx> wrote: > > +Tools like bindgen and cbindgen create C-styled unsafe Rust code rather than > > +idiomatic Rust; where possible, we prefer to switch to idiomatic Rust. Any > > +standard C library functions that are needed can be manually wrapped on the > > +Rust side. > > I agree that we want to use idiomatic Rust whenever possible. However, > I don't want to define structures and function definitions in both > languages and rely on people keeping them in sync, since that's a great > way to create brittle, broken code. Very notably, I have seen these > kinds of misalignments break only on big-endian architectures, which > most of us do not use, so we can really end up causing problems that are > very subtle this way. > > I would prefer we wrote these functions with cbindgen to avoid this. If > we define structures only in Rust and never ever use C structures, then > we can avoid bindgen. Could you create a patch with your preferred wording about bindgen and cbindgen for me? I'd prefer to introduce bindgen/cbindgen in a different patch series because this one is already doing a lot just to make Rust exist in Git.