rust-lang / rust-lang/rust-bindgen
`static mut` deprecation
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
There is a current pre-RFC for deprecating static mut in Rust 2024, in favor of better alternatives. I think bindgen should start using some of these alternatives instead of generating code that will become deprecated in the near-term. My understanding of the pre-RFC is that we should be using SyncUnsafeCell in these FFI scenarios instead of static mut
Input C/C++ Header
extern const void* FOO;
Bindgen Invocation
bindgen::Builder::default()
.header("input.h")
.generate()
.unwrap()
Actual Results
extern "C" {
pub static mut Foo: *const ::core::ffi::c_void;
}
Expected Results
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 with the C++ header and the bindgen::Builder invocation, then trace how the extern global becomes the shown Rust binding; done means the generated FFI binding avoids deprecated static mut while preserving the declared global interface.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- compilers, devtools
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100