]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/const-pattern-not-const-evaluable.rs
Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco
[rust.git] / tests / ui / consts / const-pattern-not-const-evaluable.rs
1 // build-pass (FIXME(62277): could be check-pass?)
2
3 #[derive(PartialEq, Eq)]
4 enum Cake {
5     BlackForest,
6     Marmor,
7 }
8 use Cake::*;
9
10 struct Pair<A, B>(A, B);
11
12 const BOO: Pair<Cake, Cake> = Pair(Marmor, BlackForest);
13 const FOO: Cake = BOO.1;
14
15 const fn foo() -> Cake {
16     Marmor
17 }
18
19 const WORKS: Cake = Marmor;
20
21 const GOO: Cake = foo();
22
23 fn main() {
24     match BlackForest {
25         FOO => println!("hi"),
26         GOO => println!("meh"),
27         WORKS => println!("möp"),
28         _ => println!("bye"),
29     }
30 }