rust-lang / rust-lang/rust-bindgen
feature request: add option to map nonull to ptr::NonNull
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
There is supported by clang extension to mark pointers as nonnull
Input C/C++ Header
#if defined(__clang__)
#define C4NONNULL __attribute((nonnull))
#else
#define C4NONNULL /**/
#endif
void f(int *p C4NONNULL);
It would be nice to have option to automatically convert types with such attribute to std::ptr::NonNull,
this repr(transparent) type so this would be valid transformation.
I deal with big enough C API where a lot of argument types have such attribute,
and this automatic conversation will help.
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
No files, tests, or entry points are named. Start by reading bindgen's handling of Clang nonnull attributes and pointer type generation; done means an option converts pointers marked with the attribute to ptr::NonNull and has coverage for the transformation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp, rust
- Domain
- compilers, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100