rust-lang / rust-lang/rust-bindgen

Incorrect doc-comments generated for enum variants

Open
#1,829 6 comments 0 reactions 1 assignee View on GitHub

@kulp is already working on this.

Since Jul 17, 2020.

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

Description

It looks like bindgen sees a doc-comment for a particular enum variant then keeps using the same doc-comment for every variant afterwards, instead of just the variant being documented.

Input C/C++ Header
typedef enum parameter_t {
    speed,
    acceleration,
    /// The amount of backlash in the system.
    backlash,
    desired_speed,
    position,
    desired_position,
} parameter_t;
Bindgen Invocation
$ bindgen input.h
Actual Results
pub const parameter_t_speed: parameter_t = 0;
pub const parameter_t_acceleration: parameter_t = 1;
/// The amount of backlash in the system.
pub const parameter_t_backlash: parameter_t = 2;
/// The amount of backlash in the system.
pub const parameter_t_desired_speed: parameter_t = 3;
/// The amount of backlash in the system.
pub const parameter_t_position: parameter_t = 4;
/// The amount of backlash in the system.
pub const parameter_t_desired_position: parameter_t = 5;
pub type parameter_t = i32;
Expected Results
pub const parameter_t_speed: parameter_t = 0;
pub const parameter_t_acceleration: parameter_t = 1;
/// The amount of backlash in the system.
pub const parameter_t_backlash: parameter_t = 2;
pub const parameter_t_desired_speed: parameter_t = 3;
pub const parameter_t_position: parameter_t = 4;
pub const parameter_t_desired_position: parameter_t = 5;
pub type parameter_t = i32;

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.