rust-lang / rust-lang/rust-bindgen
generated function has an argument which shadows a generated static
Open
Nobody has claimed this yet.
bug
I-bogus-codegen
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Input C/C++ Header
Perhaps soon.
Bindgen Invocation
let bindings = bindgen::Builder::default()
.generate_comments(true)
.clang_arg("-I../../src")
.clang_arg("-I../../lib")
.header("wrapper.h")
.hide_type("BOOL_VECTOR_BITS_PER_CHAR")
.generate()
.expect("Unable to generate bindings");
Actual Results
error[E0530]: function parameters cannot shadow statics
--> /home/db48x/projects/remacs/rust_src/remacs-sys/target/debug/build/remacs-sys-992c0642432c4683/out/bindings.rs:29414:27
|
29414 | face_change: bool_bf) -> u64 {
| ^^^^^^^^^^^ cannot be named the same as a static
...
50626 | pub static mut face_change: bool;
| --------------------------------- a static `face_change` is defined here
Expected Results
Hard to say how I would change this; probably by tweaking the argument name. That seems the simplest, because it only affects one function rather than everyone who wanted to use the static.
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
Reproduce the bindgen invocation using the referenced C/C++ header and inspect the generated bindings around the reported lines in bindings.rs. Trace how the function argument and static named face_change are emitted, then verify that generated Rust compiles without the naming collision while preserving access to the static.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cpp, rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100