Skip to content

Cannot use constants as enum values #94

@OpenByteDev

Description

@OpenByteDev

Since the update from 0.5.7 to 0.5.8 using a constants as the value of an enum variant does not work anymore:

const CONST_ONE: u32 = 1;
#[derive(
    TryFromPrimitive, IntoPrimitive
)]
#[repr(u32)]
pub enum Enum {
    One = CONST_ONE,
}

Produces the following error:

error: Expected literal
  --> src\error.rs:58:11
   |
58 |     One = CONST_ONE,
   |           ^^^^^^^^^

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions