1 #![allow(stable_features)]
2 #![allow(unused_imports)]
3 // Test that cleanup scope for temporaries created in a match
4 // arm is confined to the match arm itself.
6 // pretty-expanded FIXME #23616
8 #![feature(box_syntax, os)]
12 struct Test { x: isize }
15 fn get_x(&self) -> Option<Box<isize>> {
20 fn do_something(t: &Test) -> isize {
22 // The cleanup scope for the result of `t.get_x()` should be the
23 // arm itself and not the match, otherwise we'll (potentially) get
24 // a crash trying to free an uninitialized stack slot.
27 &Test { x: 2 } if t.get_x().is_some() => {
35 let t = Test { x: 1 };