]> git.lizzy.rs Git - rust.git/blob - src/test/run-fail/mir_codegen_calls_converging_drops_2.rs
Auto merge of #63994 - Centril:refactor-qualify-consts, r=spastorino,oli-obk
[rust.git] / src / test / run-fail / mir_codegen_calls_converging_drops_2.rs
1 // error-pattern:complex called
2 // error-pattern:dropped
3 // error-pattern:exit
4
5 struct Droppable;
6 impl Drop for Droppable {
7     fn drop(&mut self) {
8         eprintln!("dropped");
9     }
10 }
11
12 // return value of this function is copied into the return slot
13 fn complex() -> u64 {
14     eprintln!("complex called");
15     42
16 }
17
18
19 fn mir() -> u64 {
20     let x = Droppable;
21     return complex();
22     drop(x);
23 }
24
25 pub fn main() {
26     assert_eq!(mir(), 42);
27     panic!("exit");
28 }