rust-lang / rust-lang/rust-bindgen
Consider using field names for anonymous types/unions
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
While they have a good chance of avoiding namespace collisions, numbered anonymous types are decidedly not very readable.
It would be nice if bindgen could use the field name instead when naming the anonymous type. In the above example, hwloc_bridge_attr_s__bindgen_ty_1 would become hwloc_bridge_attr_s__upstream and hwloc_bridge_attr_s__bindgen_ty_2 would become hwloc_bridge_attr_s__downstream.
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 source file or test is named. Start by locating bindgen's handling of anonymous types and unions, then compare generated bindings with the issue's hwloc_bridge_attr_s example. Done means the anonymous types use field-based names such as __upstream and __downstream while still avoiding namespace collisions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100