diff options
| author | Caio <c410.f3r@gmail.com> | 2021-09-15 14:03:27 -0300 |
|---|---|---|
| committer | Caio <c410.f3r@gmail.com> | 2021-09-15 14:03:27 -0300 |
| commit | 1b0186e9ecdaa6fd00f1beea7d877b5a4fbd762d (patch) | |
| tree | b7ee76eff04de2e2b50d74c71a7c87bc0c6f4f36 /src/test/ui/structs-enums | |
| parent | 8c2b6ea37d7719a0370bd404030eef9702c1752c (diff) | |
| download | rust-1b0186e9ecdaa6fd00f1beea7d877b5a4fbd762d.tar.gz rust-1b0186e9ecdaa6fd00f1beea7d877b5a4fbd762d.zip | |
Move some tests to more reasonable directories
Diffstat (limited to 'src/test/ui/structs-enums')
| -rw-r--r-- | src/test/ui/structs-enums/issue-38002.rs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/ui/structs-enums/issue-38002.rs b/src/test/ui/structs-enums/issue-38002.rs new file mode 100644 index 00000000000..fdb31fc44a1 --- /dev/null +++ b/src/test/ui/structs-enums/issue-38002.rs @@ -0,0 +1,35 @@ +// run-pass +#![allow(dead_code)] +// Check that constant ADTs are codegened OK, part k of N. + +enum Bar { + C +} + +enum Foo { + A {}, + B { + y: usize, + z: Bar + }, +} + +const LIST: [(usize, Foo); 2] = [ + (51, Foo::B { y: 42, z: Bar::C }), + (52, Foo::B { y: 45, z: Bar::C }), +]; + +pub fn main() { + match LIST { + [ + (51, Foo::B { y: 42, z: Bar::C }), + (52, Foo::B { y: 45, z: Bar::C }) + ] => {} + _ => { + // I would want to print the enum here, but if + // the discriminant is garbage this causes an + // `unreachable` and silent process exit. + panic!("trivial match failed") + } + } +} |
