Skip to content

enum expects determinant to be isize #21493

Closed
@dcampbell24

Description

@dcampbell24
const ZERO : i32 = 0;

// OK
#[derive(Copy)]
pub enum A {
    Zero = 0,
}

// Not OK
#[derive(Copy)]
pub enum B {
    Zero = ZERO,
}

pub fn main() {}
<anon>:12:12: 12:16 error: mismatched types:
 expected `isize`,
    found `i32`
(expected isize,
    found i32)
<anon>:12     Zero = ZERO,
                     ^~~~
error: aborting due to previous error
playpen: application terminated with error code 101

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions