rust-lang / rust-lang/rust-bindgen

Option to output opaque type as `c_void`

Open
#1,874 1 comment 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Rust
Stars
5.3k
Forks
829
Avg merge
1d 1h
Merged PRs (30d)
15

Description

In some cases, an opaque type will only be handled as a pointer to that type (eg: *mut WINDOW in curses).

In this case, it would be nice to have an option where a type can be output as a c_void alias, so that it's better communicated to the user that they're really not supposed to be reading and writing past the pointer.

// opaque
pub type WINDOW = [u64; 11usize];

// opaque_void
pub type WINDOW = ::core::ffi::c_void;

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how bindgen represents and emits opaque types and where generation options are defined. Determine how an option should select c_void output for opaque types such as WINDOW, then verify that the generated binding uses the c_void alias while preserving existing opaque output behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.