rust-lang / rust-lang/rust-bindgen

Pass the kind of item to `ParseCallbacks::item_name`

Open
#2,736 1 comment 0 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

Input C/C++ Header
enum long_prefix_to_remove_foo {
  BAR = 0
};

int long_prefix_to_remove_bar();

There is no way to implement ParseCallbacks::item_name that can follow different naming logic for these two items.

I propose that item_name be refactored to look more like generated_name_override, which passes in an info struct instead of solely a name.

Cc @vsukhoml

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 with the ParseCallbacks::item_name API and compare its signature and inputs with generated_name_override, following the callback implementation and callers. Done means the callback receives enough item information to apply different naming logic to the enum and function shown, while preserving existing callback behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.