Skip to content

Disallow passing _Complex by value #3255

@SabrinaJewson

Description

@SabrinaJewson

As seen in rust-lang/rfcs#793 and rust-lang/libc#355, C’s _Complex has a different ABI (but not layout) to what Bindgen currently generates, which is:

#[derive(PartialEq, Copy, Clone, Hash, Debug, Default)]
#[repr(C)]
pub struct __BindgenComplex<T> {
    pub re: T,
    pub im: T,
}

As a soundness fix, I suggest erroring when the user attempts to use _Complex by value. Maybe this could be done with a flag to disable it if the user really wants the potentially-unsound behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions