Skip to content

Derive Debug is not generated for structs with large array fields (len() > 32) (need to add new rustc target) #1977

Closed

Description

@DmitrySamoylov

Hi! If my struct contains large arrays, then Debug is not being generated. However if I add Debug manually, it compiles and runs just fine.

Input C/C++ Header

typedef struct {
    char f[33];
} A;

Bindgen Invocation

$ bindgen input.h

Actual Results

/* automatically generated by rust-bindgen 0.56.0 */

#[repr(C)]
#[derive(Copy, Clone)]
pub struct A {
    pub f: [::std::os::raw::c_char; 33usize],
}

...

Expected Results

#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct A {
    pub f: [::std::os::raw::c_char; 33usize],
}

Activity

  1. jplatte commented on Jan 26, 2021

    @jplatte
    Contributor

    Arrays with more than 32 elements only implement Debug since 1.47.

  2. jplatte commented on Jan 26, 2021

    @jplatte
    Contributor

    The latest --rust-target supported being 1.47 apart from nightly, I guess this won't be supported even with --rust-target nightly.

  3. emilio commented on Jan 29, 2021

    @emilio
    Contributor

    If Rust supports this now we should add a new rustc version to the code and restrict the limitations to older versions of rust.

  4. changed the title [-]Derive `Debug` is not generated for structs with large array fields (len() > 32)[/-] [+]Derive `Debug` is not generated for structs with large array fields (len() > 32) (need to add new rustc target)[/+] on Jan 29, 2021
  5. jplatte commented on Jan 29, 2021

    @jplatte
    Contributor

    I've already done the first part, I'll try to get to the latter soon or post a WIP PR with some notes if I don't find the time to finish it (or somebody else is eager to work on this 🙂).

  6. added a commit that references this issue on Jan 28, 2024
    a380678
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions