]>
Commit | Line | Data |
---|---|---|
29967ef6 XL |
1 | 1| |#![allow(unused_assignments)] |
2 | 2| |// expect-exit-status-1 | |
3 | 3| | | |
4 | 4| |struct Firework { | |
5 | 5| | strength: i32, | |
6 | 6| |} | |
7 | 7| | | |
8 | 8| |impl Drop for Firework { | |
9 | 9| 2| fn drop(&mut self) { | |
10 | 10| 2| println!("BOOM times {}!!!", self.strength); | |
11 | 11| 2| } | |
12 | 12| |} | |
13 | 13| | | |
14 | 14| |fn main() -> Result<(),u8> { | |
15 | 15| 1| let _firecracker = Firework { strength: 1 }; | |
16 | 16| 1| | |
17 | 17| 1| let _tnt = Firework { strength: 100 }; | |
18 | 18| | | |
19 | 19| 1| if true { | |
20 | 20| 1| println!("Exiting with error..."); | |
21 | 21| 1| return Err(1); | |
22 | 22| | } | |
23 | 23| | | |
24 | 24| | let _ = Firework { strength: 1000 }; | |
25 | 25| | | |
26 | 26| | Ok(()) | |
27 | 27| 1|} | |
28 | 28| | | |
29 | 29| |// Expected program output: | |
30 | 30| |// Exiting with error... | |
31 | 31| |// BOOM times 100!!! | |
32 | 32| |// BOOM times 1!!! | |
33 | 33| |// Error: 1 | |
34 |