fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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