Closed ian-h-chamberlain closed 3 months ago
I would prefer, I think, making blocklist_type("__BindgenBitfieldUnit") work and documenting it I believe
(same for the other built-in types of course)
Ah, that would make sense! I think I can adjust my first attempt to handle that without too much trouble, at least for the bitfield unit type. I'll look at doing the same for other generated types too.
Do you have a suggestion for where exactly to document this (e.g. on blocklist_type
itself, or perhaps in the book's "bitfields" page? The latter might make sense for the bitfield unit specifically, but maybe not for anonymous types like _bindgen_ty_1
Hi! This is kind of a feature request for a (maybe unusual) use case where bindings are generated in multiple different crates. In our case we have
citro3d-sys
which depends on some types inctru-sys
.The idea is to reuse existing types from
ctru-sys
wherever possible, instead of regenerating a duplicate definition. For the most part, this works great withallowlist_type
/blocklist_type
, so we can use something like this:There is one exception where this doesn't work —
bindgen
-generated types for bitfields. The various_bindgen_ty_*
seem to avoid overlap (whether this is by design due to deterministic naming, or just coincidence?), but both sets generatepub struct __BindgenBitfieldUnit<Storage>
as well, which unfortunately does overlap.Input C/C++ Header
Minimal reproduction with two crates
a
andb
:a.h
:b.h
:Bindgen Invocation
a/build.rs
:b/build.rs
:Actual Results
With
b/lib.rs
:Expected Results
I think the simplest option to address this in our case would be a flag to skip generating the
__BindgenBitfieldUnit
type — would a PR be accepted to add such a flag? I have mostly worked out the implementation already, but maybe there's a better/simpler way to support this kind of use case?If it would be accepted, I can open a PR adding a
skip_bindgen_bitfield_unit
flag, which in this case could be used to avoid the generated conflict by reusinga
's version of the struct instead of generating a new one inb
.Thank you!