rust-lang / rust-lang/rust-bindgen

[performance and security] should support `__attribute__((__deprecated__(MSG)))`

Open
#2,675 2 comments 1 reaction 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
#define DEPRECATE(f) __attribute__((__deprecated__("Use '" #f "' instead")))

DEPRECATE(bar)
int foo();

int bar();
Bindgen Invocation
bindgen::Builder::default()
    .header("input.h")
    .generate()
    .unwrap()
Actual Results
extern "C" {
    pub fn foo() -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn bar() -> ::std::os::raw::c_int;
}
Expected Results

bindgen mapping deprecation to rust, and should be default option

extern "C" {
   {{RUST_DEPRECATION}}
    pub fn foo() -> ::std::os::raw::c_int;
}
extern "C" {
    pub fn bar() -> ::std::os::raw::c_int;
}

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 input.h example and the bindgen::Builder invocation shown in the issue, then reproduce the generated bindings. Done means the deprecated foo declaration receives the Rust deprecation mapping while bar remains unchanged, with the behavior enabled by default.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.