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