rust-lang / rust-lang/rust-bindgen
Incorrect query of whether given comp type is an union in analyses
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Analyses like derive_partial_eq_or_partial_ord assumes that if some Comp type is an union and rust target version allows us to use untagged union feature, then that Comp type will be emitted as a rust untagged union.
However, this can be not true, because in codegen we still can decide to emit bindgen union instead of rust union.
This header should reproduce the case
union U4 {
unsigned derp : 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 with src/ir/analysis/derive_partial_eq_or_partial_ord.rs and the union handling in src/ir/comp.rs, especially the linked locations. Reproduce the behavior with the header containing union U4 { unsigned derp : 1; }; and trace whether the analysis and codegen make the same union-kind decision. Done means the analysis reflects the union form that codegen will emit.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, rust
- Domain
- compilers, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100