rust-lang / rust-lang/rust-bindgen
Should not derive Debug, Copy, Clone for struct without definition
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Input C/C++ Header
typedef struct foo bar;
Bindgen Invocation
$ bindgen input.h
Actual Results
/* automatically generated by rust-bindgen 0.56.0 */
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct foo {
_unused: [u8; 0],
}
pub type bar = foo;
Expected Results
Debug, Copy, Clone should not be derived if bindgen does not know the true size or layout of struct foo and is just using a placeholder. Obviously I can use no_copy, no_debug, no_defaultto suppress it, but bindgen should never derive these traits on such a struct no matter how these flags are set.
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 reported input.h and bindgen invocation first, then inspect the code path that emits derives for placeholder structs. Done means generated bindings for typedef struct foo bar; omit Debug, Copy, and Clone while preserving the placeholder and alias behavior.
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
- Clearly specified
- Newbie friendliness
- 45/100