rust/tests/ui/structs-enums/enum-nullable-simplifycfg-misopt.rs

17 lines
454 B
Rust
Raw Normal View History

//@ run-pass
2013-10-23 08:49:18 +00:00
/*!
* This is a regression test for a bug in LLVM, fixed in upstream r179587,
* where the switch instructions generated for destructuring enums
* represented with nullable pointers could be misoptimized in some cases.
*/
enum List<X> { Nil, Cons(X, #[allow(dead_code)] Box<List<X>>) }
pub fn main() {
match List::Cons(10, Box::new(List::Nil)) {
2015-01-25 21:05:03 +00:00
List::Cons(10, _) => {}
List::Nil => {}
_ => panic!()
}
}