Skip to content

enum discriminant should only be as big as needed #5024

Closed
@thestinger

Description

@thestinger

I don't think there's any need to make these 64-bit, or even require that they be 32-bit. It's somewhat surprising how big stuff like Option<()> is at the moment. It's very painful for stuff like SmallIntMap and Deque that use ~[Option<T>], and for implementing set types as wrappers around map types.

For compatibility with C code, a #[discriminant = c_int] attribute can be offered to choose whatever primitive integer type is desired (C++11 has this feature too, as class enum foo: uint8_t)

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