Skip to content

Can't implement Copy for C style enums with negative discriminants that overflow into unspecified positive discriminants #23221

Closed

Description

fn main() { }

#[repr(C)]
#[derive(Copy)]
enum X {
    A = -1,
    B,
}
test5.rs:7:5: 7:6 error: Discriminant overflowed!
test5.rs:7     B,
               ^
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    A-FFIArea: Foreign function interface (FFI)Area: Foreign function interface (FFI)A-typesystemArea: The type systemArea: The type system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions