rust-lang / rust-lang/rust-bindgen
Consider making generated TokenStream public
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
There's a need for an API for manipulating generated items according to some open issues here. For a library I'm working on, I run an extra step which generates some glue code on top of the bindgen output.
Unfortunately, I have to write out the bindings to a file first and then re-read them back, because tokens are made private here:
https://github.com/rust-lang/rust-bindgen/blob/master/src/lib.rs#L1914
Please consider making it public (maybe under a feature flag with re-exporting of proc_macro2::TokenStream) This is a safe change and will make it possible to manipulate the tokens (or just reuse them to generate some extra code ).
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 at src/lib.rs around line 1914, where the generated tokens are made private, and review how bindgen exposes its generated output. Determine the appropriate public API, including whether a feature flag or proc_macro2::TokenStream re-export is needed. Done means callers can manipulate or reuse the generated tokens without writing and rereading a file.
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