Allow adding attributes to functions in ParseCallbacks

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

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
63/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
tooling

Research direction

Start by reading ParseCallbacks::add_attributes() and its uses in rust-bindgen, especially the paths that add attributes to struct, enum, and union declarations. Then trace how function bindings are generated and identify where callback-provided attributes could be applied. Done means function bindings can receive attributes such as #[target_feature(enable = "sse2")]; the issue does not name a test, so check the existing callback tests for a suitable place to cover it.

Written by the indexing model from the issue text.

Description

C-feature-request

ParseCallbacks::add_attributes() is only used for struct/enum/union declarations
There doesn't seem to be a way to add attributes to functions

Use case: adding #[target_feature(enable = "sse2")] to the bindings for the functions in https://github.com/php/php-src/blob/PHP-8.5.12/Zend/zend_simd.h#L49, which are only defined on the C side when SSE2 is available

Dominant language
Rust
Stars
5.3k
Forks
846
Avg merge
2d 6h
Merged PRs (30d)
11

Getting set up

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.

More from rust-lang/rust-bindgen

All issues in rust-lang/rust-bindgen

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.