Rust's char
is not guaranteed to be ABI-compatible with C++'s uint32_t
#814
Labels
char
is not guaranteed to be ABI-compatible with C++'s uint32_t
#814
Today
cbindgen
translates Rust'schar
into C++'suint32_t
(see here). (It used to translate intochar32_t
, but this was changed in a PR a few years ago.) This seems to work, but AFAIU Rust makes no guarantees wrt ABI behavior of Rust's built-inchar
type. In particular, the ABI may ask to use different registers depending on whether the type is classified as an integer or not (and Rust doesn't guarantee any particular classification of Rust'schar
).Other notes:
improper_ctypes
warning fires forchar
(see example Rust playground)cxx
doesn't support thechar
typechar
may also have the same bug (e.g. Crubit and Diplomat)/cc @Manishearth who has kindly brought this issue to my attention
The text was updated successfully, but these errors were encountered: