Skip to content

non-exhaustive match failure in eval_const_expr when shift arguments differ in signedness #2426

Closed
@msullivan

Description

@msullivan

eval_const_expr always requires the arguments of a binary op to have the same type, which needn't be true for shift operators. Forcing eval_const_expr to be called on such a shift triggers a compiler failure.

enum bs { thing = 5 >> 1u }
fn main() {
    log(error, thing as int);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-frontendArea: Compiler frontend (errors, parsing and HIR)I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions