Skip to content

new_type_alias breaks constant generation #3287

@maurer

Description

@maurer

Today, we write in a header

typedef uint64_t Foo;
static const Foo Foo_A = 0x1;

and invoke bindgen with --new-type-alias Foo, we'll get:

#[repr(transparent)]
#[derive(Debug, Default, Copy, Clone, PartialEq)]
pub struct Foo(pub u64);
pub const  Foo_A: Foo = 1;

which won't compile. If we've decided to apply newtype to an alias, we should wrap constants in the appropriate constructor to make it work.

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