rust-lang / rust-lang/rust-bindgen
Generate `std::ffi::*` instead of the `std::os::raw::*` types
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
std::os::raw recommends to use core::ffi instead, but for std crates using core directly seem to trigger some warnings. The std::ffi::* offers the same types like c_char and c_int as core::ffi::*, plus it offers the newer types like CStr in there. Would it make sense to consistently use just the std::ffi::* for all C types in the generated code?
P.S. I am aware that this can be done with .ctypes_prefix("::std::ffi") param - but the question is if this should be done by default?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing ctypes_prefix("::std::ffi") behavior and how generated bindings select paths for C types. Determine whether using std::ffi::* by default is compatible with the stated warning concerns, then validate the decision against generated bindings covering types such as c_char, c_int, and CStr.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100