Skip to content

extern const array is unexpectedly mut #1727

@bobbobbio

Description

@bobbobbio

Input C/C++ Header

extern const int foo[1];

Bindgen Invocation

$ bindgen input.h

Actual Results

/* automatically generated by rust-bindgen */

extern "C" {
    pub static mut foo: [::std::os::raw::c_int; 1usize];
}

Expected Results

/* automatically generated by rust-bindgen */

extern "C" {
    pub static foo: [::std::os::raw::c_int; 1usize];
}

The const from the array seems to be lost. Arrays are a bit strange in C, but as best I can tell when you put const on an array it does in fact mean that values in the array are const, and as such the binding on the Rust side should not be mut.

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