summary refs log tree commit diff
path: root/src/test/ui/consts/control-flow/issue-46843.rs
blob: 1fc91015ffa702351cd0e8eb345c3f17236e88cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// revisions: stock if_match

#![cfg_attr(if_match, feature(const_if_match))]

enum Thing { This, That }

fn non_const() -> Thing {
    Thing::This
}

pub const Q: i32 = match non_const() {
    //[stock]~^ ERROR `match` is not allowed in a `const`
    //[if_match]~^^ ERROR calls in constants are limited to constant functions
    Thing::This => 1,
    Thing::That => 0
};

fn main() {}