Skip to content

the trait bound [u8; 44]: std::default::Default is not satisfied #1718

Closed
@yaa110

Description

@yaa110

I change the bindgen version from 0.30.0 to 0.52.0 in nginx crate.

Header

#include <ngx_http.h>

Bindgen Invocation

let bindings = bindgen::Builder::default()
        .derive_debug(false)
        .header("wrapper.h")
        .layout_tests(false)
        .clang_args(vec![
            format!("-I{}/src/core", nginx_dir),
            format!("-I{}/src/event", nginx_dir),
            format!("-I{}/src/event/modules", nginx_dir),
            format!("-I{}/src/os/unix", nginx_dir),
            format!("-I{}/objs", nginx_dir),
            format!("-I{}/src/http", nginx_dir),
            format!("-I{}/src/http/v2", nginx_dir),
            format!("-I{}/src/http/modules", nginx_dir),
        ])
        .generate()
        .expect("Unable to generate bindings");

Actual Results

error[E0277]: the trait bound `[u8; 44]: std::default::Default` is not satisfied
     --> /module/target/release/build/nginx-96f1184c07e3304c/out/bindings.rs:19021:13
      |
19021 |             Default::default();
      |             ^^^^^^^^^^^^^^^^ the trait `std::default::Default` is not implemented for `[u8; 44]`
      |
      = help: the following implementations were found:
                <&[T] as std::default::Default>
                <&mut [T] as std::default::Default>
                <[T; 0] as std::default::Default>
                <[T; 10] as std::default::Default>
              and 31 others
      = note: required because of the requirements on the impl of `std::default::Default` for `bindings::__BindgenBitfieldUnit<[u8; 44], u8>`
      = note: required by `std::default::Default::default`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0277`.
error: could not compile `nginx`.

Expected Results

The crate is successfully built using v0.30.0 of bindgen, however an update to bindgen version causes the problem. I tried derive_default(true) with no success.

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