]> git.lizzy.rs Git - rust.git/blob - tests/ui/mir/mir_codegen_calls_converging_drops_2.rs
Rollup merge of #106701 - ibraheemdev:sync-sender-spin, r=Amanieu
[rust.git] / tests / ui / mir / mir_codegen_calls_converging_drops_2.rs
1 // run-fail
2 // error-pattern:complex called
3 // error-pattern:dropped
4 // error-pattern:exit
5 // ignore-emscripten no processes
6
7 struct Droppable;
8 impl Drop for Droppable {
9     fn drop(&mut self) {
10         eprintln!("dropped");
11     }
12 }
13
14 // return value of this function is copied into the return slot
15 fn complex() -> u64 {
16     eprintln!("complex called");
17     42
18 }
19
20
21 fn mir() -> u64 {
22     let x = Droppable;
23     return complex();
24     drop(x);
25 }
26
27 pub fn main() {
28     assert_eq!(mir(), 42);
29     panic!("exit");
30 }