rust-lang / rust-lang/rust-bindgen
bindgen can't generate thread local variables correctly
Open
Nobody has claimed this yet.
bug
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
I don't know whether it's really an issue since stable rust doesn't support thread_local yet.
Input C/C++ Header
static __thread int variable_1 = 0;
thread_local int variable_2 = 0;
Bindgen Invocation
bindgen::Builder::default()
.header("input.h")
.rust_target(bindgen::RustTarget::Nightly)
.generate()
.unwrap()
or
$ bindgen input.h --whatever --flags
Actual Results
pub static mut variable_1 ...
Expected Results
#[thread_local]
pub static mut variable_1
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 by reproducing the issue with the input.h declarations through bindgen::Builder and the bindgen CLI, then compare the generated output for both thread-local variables. Done means the generated binding represents the supported thread-local declaration with #[thread_local] rather than only pub static mut.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100