]> git.lizzy.rs Git - rust.git/blob - src/test/ui/structs-enums/enum-nullable-simplifycfg-misopt.rs
Rollup merge of #89468 - FabianWolff:issue-89358, r=jackh726
[rust.git] / src / test / ui / structs-enums / enum-nullable-simplifycfg-misopt.rs
1 // run-pass
2
3 /*!
4  * This is a regression test for a bug in LLVM, fixed in upstream r179587,
5  * where the switch instructions generated for destructuring enums
6  * represented with nullable pointers could be misoptimized in some cases.
7  */
8
9 enum List<X> { Nil, Cons(X, Box<List<X>>) }
10 pub fn main() {
11     match List::Cons(10, Box::new(List::Nil)) {
12         List::Cons(10, _) => {}
13         List::Nil => {}
14         _ => panic!()
15     }
16 }