2 #![allow(non_upper_case_globals)]
4 static mut drop_count: usize = 0;
12 // Test to make sure we haven't dropped already
13 assert!(!self.dropped);
15 // And record the fact that we dropped for verification later
16 unsafe { drop_count += 1; }
21 // An `if true { expr }` statement should compile the same as `{ expr }`.
23 let _a = Foo{ dropped: false };
25 // Check that we dropped already (as expected from a `{ expr }`).
26 unsafe { assert_eq!(drop_count, 1); }
28 // An `if false {} else { expr }` statement should compile the same as `{ expr }`.
32 let _a = Foo{ dropped: false };
34 // Check that we dropped already (as expected from a `{ expr }`).
35 unsafe { assert_eq!(drop_count, 2); }