rust-lang / rust-lang/rust-bindgen
Blacklisting doesn't hide inner types, and the template analysis gets confused.
Open
Nobody has claimed this yet.
A-templates
bug
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
Input C/C++ Header
template <typename T>
struct Transform {
T t;
};
template <typename A, typename B, typename C>
struct TransformOp {
A a;
B b;
C c;
struct InterpolateMatrix_Body {
Transform<TransformOp<A, B, C>> from;
Transform<TransformOp<A, B, C>> to;
A a;
};
};
Bindgen Invocation
$ ./target/debug/bindgen t.hpp --blacklist-type TransformOp --blacklist-type Transform
Actual Results
#[repr(C)]
pub struct TransformOp_InterpolateMatrix_Body<A> {
pub from: Transform<TransformOp<A, B, C>>,
pub to: Transform<TransformOp<A, B, C>>,
pub a: A,
pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<A>>,
}
Which as you can see uses the types B, and C, which we forget to append to the aliases. I think blacklisting something should stop generating all the inner types, but not sure if anybody relies on that.
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 output from t.hpp with the shown bindgen invocation and blacklists for TransformOp and Transform. Trace how blacklisting interacts with the generated InterpolateMatrix_Body inner type and its aliases, then verify that the resulting bindings no longer produce the inconsistent A-only alias output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, rust
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100