[Feature Request] Const of unit type generate "empty" defines
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3k
- Forks
- 386
- Avg merge
- 1h 43m
- Merged PRs (30d)
- 1
Description
In my project, depending on the target some definitions should expand to nothing instead of a number.
I would like that if a const defined as a unit type generated an empty define:
const MYCONST: () = () —> #define MYCONST
Currently I'm using a hack, since I do have a header that are included on all other headers, I create a manual #define None and make the const equal to None. That in turns generate #define [NAME] None, in the grand scheme of things, C preprocessor expand to nothing, as expected. But would be nice to have something easier and less hacky.
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
Trace cbindgen's handling of Rust const items and unit types; no source file or test is named in the issue, so begin by locating the code and existing tests for generated #define values. Done means const MYCONST: () = () generates #define MYCONST, while existing non-unit constants retain their current output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100