rust-lang / rust-lang/rust-bindgen
Bindgen does not keep documentation of #define constants
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
C libraries commonly (ab)use defines to represent compilation constants. Therefore, the Doxygen documentation of these defines can contain valuable information and should be kept by bindgen, but alas it currently does not happen.
I am well aware that because defines are handled by the preprocessor, solving this may be harder than it sounds...
Input C/C++ Header
/** \brief Current component and plugin ABI version (see hwloc/plugins.h) */
#define HWLOC_COMPONENT_ABI 7
Bindgen Invocation
$ bindgen input.h
Actual Results
Bindgen discards the docs:
pub const HWLOC_COMPONENT_ABI: u32 = 7;
Expected Results
Bindgen keeps the docs around:
#[doc = " \brief Current component and plugin ABI version (see hwloc/plugins.h) "]
pub const HWLOC_COMPONENT_ABI: u32 = 7;
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
Reproduce the issue with the shown input.h and bindgen invocation, then trace the handling of the documented #define that becomes a Rust pub const. Done means the generated constant retains the Doxygen text as a Rust doc attribute, matching the expected output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100