Skip to content

ICE when setting a enum discriminator to an unsigned constant #2467

Closed
@msullivan

Description

@msullivan

Trying to compile:

enum test { thing = 3u }
fn main() {
    log(error, thing as int);
    assert(thing as int == 3);
}

results in

nubs/unsigned-enum-ice.rs:1:20: 1:22 error: mismatched types: expected `int` but found `uint` (int vs uint)
nubs/unsigned-enum-ice.rs:1 enum test { thing = 3u }
                                                ^~
nubs/unsigned-enum-ice.rs:1:20: 1:22 error: expected signed integer constant
nubs/unsigned-enum-ice.rs:1 enum test { thing = 3u }
                                                ^~
error: internal compiler error: tag_variants: bad disr expr

It should just have the type errors without the ICE.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemI-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions