Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DmitrySamoylov opened this issue Jan 26, 2021 · 4 comments

Comments

@DmitrySamoylov
Copy link

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],
}
@jplatte
Copy link
Contributor

jplatte commented Jan 26, 2021

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

@jplatte
Copy link
Contributor

jplatte commented Jan 26, 2021

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

@emilio
Copy link
Contributor

emilio commented Jan 29, 2021

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

@emilio emilio 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) Jan 29, 2021
@jplatte
Copy link
Contributor

jplatte commented Jan 29, 2021

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 🙂).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants