Closed anxiousmodernman closed 6 years ago
One way to deal with this is to "blacklist" the type in build.rs and provide our own Rust type alias for IRQn_Type
to the Rust primitive i8
. Not sure where to put the Rust code, yet.
~I've been asked to open an issue on bindgen re: this.~ So I got some help in the servo IRC, and it seems that our own alias to c_schar is what bindgen is picking up.
Changing this to i8
makes the compiler happy. It seems like that should be fine.
Update: definitely not fine. A lot of other enums values that should be u8 are affected, and critically it seems they're passed to functions that expect u8. The simpler route might be to leave mod ctypes alone but provide an i8
implementation of IRQn_Type
.
It seems that the latest bindgen is emitting a
u8
alias for values from this C enum, which includes negative ints:https://github.com/jamesmunns/nrf52dk-sys/blob/master/nRF5-sdk/components/device/nrf52.h#L74-L126
There are a couple of strategies related to "bind gen did the wrong thing" in the bindgen docs. Since we need to match those numbers exactly we might need to provide our own Rust implementation.
The error:![bindgen](https://user-images.githubusercontent.com/396004/32420041-9809f272-c239-11e7-843d-e96291f73fe5.png)