]> git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/control-flow/issue-46843.rs
New upstream version 1.41.1+dfsg1
[rustc.git] / src / test / ui / consts / control-flow / issue-46843.rs
1 // revisions: stock if_match
2
3 #![cfg_attr(if_match, feature(const_if_match))]
4
5 enum Thing { This, That }
6
7 fn non_const() -> Thing {
8 Thing::This
9 }
10
11 pub const Q: i32 = match non_const() {
12 //[stock]~^ ERROR `match` is not allowed in a `const`
13 //[if_match]~^^ ERROR calls in constants are limited to constant functions
14 Thing::This => 1,
15 Thing::That => 0
16 };
17
18 fn main() {}