rust-lang / rust-lang/rust-bindgen

Feature request: use C2Rust to generate Rust versions of static inline functions

Open
#1,344 6 comments 7 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

As described in #1090, bindgen is currently unable to expose static inline functions defined in C header files. This is because this functions do not actually exist anywhere in the linked library, but rather only in the header file itself. The proposed solution described in the other issue requires modifying the actual generated library on the C side which isn't always possible.

C2Rust is a new tool that can directly produce Rust code from C source, which would enable bindgen to actually produce Rust versions of these static inline functions. As a result, the Rust bindings would be able call these functions while still linking to unmodified versions of the original C library.

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 reviewing issue #1090 and the C2Rust tool description linked here, then trace how bindgen handles static inline functions in C headers. Done means producing Rust versions of those functions while allowing the bindings to link against an unmodified C library; no specific files or tests are identified in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, rust
Domain
compilers, tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.