Given the following C heder:
const int* foo = ((int*) 3ULL);
bindgen will generate the following Rust code:
/* automatically generated by rust-bindgen 0.71.1 */
unsafe extern "C" {
pub static mut foo: *const ::std::os::raw::c_int;
}
The output I would expect (and need) to be generated is the following:
const FOO: *const c_int = 3usize as *const c_int;
Questions
- Is there any way to configure
bindgen to provide the output above?
- Is the generation of current output a feature or a bug?
- If it is a feature, what is the rationale behind it?
For context, we are hitting this in the Linux kernel when generating bindings for these kind of pointers.
Given the following C heder:
bindgenwill generate the following Rust code:The output I would expect (and need) to be generated is the following:
Questions
bindgento provide the output above?For context, we are hitting this in the Linux kernel when generating bindings for these kind of pointers.