rust-lang / rust-lang/rust-bindgen
Bindgen should issue an error, if forward declared types are used in function signatures.
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 5.3k
- Forks
- 829
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 15
Description
E.g. in the bindgen test func_return_must_use forward declared types are used in the function signature.
Bindgen should refuse to generate a function signature where forward declared types are used directly and not via a pointer.
struct MustUseStruct;
struct MustUseStruct return_struct();
#[repr(C)]
#[derive(Debug, Copy, Clone)]
#[must_use]
pub struct MustUseStruct {
_unused: [u8; 0],
}
unsafe extern "C" {
#[must_use]
pub fn return_struct() -> MustUseStruct;
}
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 the bindgen test func_return_must_use and reproduce the case using a forward-declared type in a function signature. Trace the signature-generation path to determine where this case is handled. Done means bindgen reports an error for direct use of a forward-declared type while still permitting pointer use.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, rust
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100