1 // check that we don't forget to drop the Box if we early return before
3 // ignore-tidy-linelength
4 // ignore-wasm32-bare compiled with panic=abort by default
6 #![feature(box_syntax)]
8 fn test() -> Option<Box<u32>> {
17 // START rustc.test.ElaborateDrops.before.mir
18 // fn test() -> std::option::Option<std::boxed::Box<u32>> {
26 // _4 = std::option::Option::<u32>::None;
27 // _3 = const <std::option::Option<u32> as std::ops::Try>::into_result(move _4) -> [return: bb2, unwind: bb3];
34 // _5 = discriminant(_3);
35 // switchInt(move _5) -> [0isize: bb10, 1isize: bb5, otherwise: bb4];
45 // _6 = ((_3 as Err).0: std::option::NoneError);
49 // _8 = const <std::option::NoneError as std::convert::From<std::option::NoneError>>::from(move _9) -> [return: bb7, unwind: bb3];
56 // _0 = const <std::option::Option<std::boxed::Box<u32>> as std::ops::Try>::from_error(move _8) -> [return: bb8, unwind: bb3];
71 // _10 = ((_3 as Ok).0: u32);
75 // drop(_2) -> [return: bb12, unwind: bb11];
82 // _0 = std::option::Option::<std::boxed::Box<u32>>::Some(move _1,);
91 // END rustc.test.ElaborateDrops.before.mir