]> git.proxmox.com Git - rustc.git/blob - src/test/ui/issues/issue-38002.rs
New upstream version 1.49.0+dfsg1
[rustc.git] / src / test / ui / issues / issue-38002.rs
1 // run-pass
2 #![allow(dead_code)]
3 // Check that constant ADTs are codegened OK, part k of N.
4
5 enum Bar {
6 C
7 }
8
9 enum Foo {
10 A {},
11 B {
12 y: usize,
13 z: Bar
14 },
15 }
16
17 const LIST: [(usize, Foo); 2] = [
18 (51, Foo::B { y: 42, z: Bar::C }),
19 (52, Foo::B { y: 45, z: Bar::C }),
20 ];
21
22 pub fn main() {
23 match LIST {
24 [
25 (51, Foo::B { y: 42, z: Bar::C }),
26 (52, Foo::B { y: 45, z: Bar::C })
27 ] => {}
28 _ => {
29 // I would want to print the enum here, but if
30 // the discriminant is garbage this causes an
31 // `unreachable` and silent process exit.
32 panic!("trivial match failed")
33 }
34 }
35 }