rust-lang / rust-lang/rust-bindgen

Invalid char array bindings generation

Open
#2,664 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Input C/C++ Header
const char BUFFER[] = "Hello" "\0" "World" "\0";
Bindgen Invocation
bindgen::Builder::default()
    .header("input.h")
    .generate()
    .unwrap()
Actual Results
pub const BUFFER: &[u8; 6] = b"Hello\0";
Expected Results
pub const BUFFER: &[u8; 13] = b"Hello\0World\0\0";

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

Reproduce the issue with input.h and the shown bindgen::Builder invocation, then trace how the C/C++ char-array constant is converted into a Rust byte slice. Done means the generated BUFFER preserves the complete concatenated value, matching the expected 13-byte output.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.