Consider emitting the c-types provided by `std`/`core`, instead of depending on `libc`
The standard library provides std::os::raw, which defines c_*-types that can be used for ffi. Those types are identical to the types provided by libc.
It would be nice if c2rust would emit the types provided by the standard library, instead of depending on an external crate. (it is annoying to replace all occurences of libc::* with the std equivalent).
The main thing to consider is that the std::os::raw types are only available with libstd but not in no_std mode, while the libc crate supports no_std.
It would be nice if c2rust would emit the types provided by the standard library, instead of depending on an external crate.
We could add an option --use-std-types to the transpiler, but I think we still need to support both sets of types. Alternatively, we could switch to std::os::raw types as the default and add an option for the libc types.
(it is annoying to replace all occurences of libc::* with the std equivalent).
The c2rust-refactor tool should be able to automate that, e.g., using rewrite_ty.
Relevant issue https://github.com/rust-lang/rust/issues/36193
@Luro02 I implemented this and created a pull request, feel free to use the std_raw_types branch while it gets reviewed.
Very cool, thank you 🤗