Skip to content

Matching on exhaustive enum errors with const_if_match #66756

Closed

Description

Example: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=13a9fbc4251d7db80f5d63b1dc35a98b

#![feature(const_if_match)]

enum E {
    A,
    B,
    C
}

const fn f(e: E) {
    match e {
        E::A => {}
        E::B => {}
        E::C => {}
    }
}
error[E0723]: const fn with unreachable code is not stable
  --> src/lib.rs:10:11
   |
10 |     match e {
   |           ^
   |
   = note: for more information, see issue https://github.com/rust-lang/rust/issues/57563
   = help: add `#![feature(const_fn)]` to the crate attributes to enable

CC: #49146, @ecstatic-morse

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Labels

A-const-evalArea: Constant evaluation (MIR interpretation)C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions