rust/tests/ui/mir/mir_codegen_calls_converging_drops_2.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
508 B
Rust
Raw Normal View History

2020-04-16 15:50:32 +09:00
// run-fail
2015-12-21 18:58:18 +02:00
// error-pattern:complex called
// error-pattern:dropped
// error-pattern:exit
2020-05-08 00:39:02 +09:00
// ignore-emscripten no processes
2015-12-21 18:58:18 +02:00
struct Droppable;
impl Drop for Droppable {
fn drop(&mut self) {
eprintln!("dropped");
2015-12-21 18:58:18 +02:00
}
}
// return value of this function is copied into the return slot
fn complex() -> u64 {
eprintln!("complex called");
2015-12-21 18:58:18 +02:00
42
}
fn mir() -> u64 {
let x = Droppable;
return complex();
drop(x);
}
pub fn main() {
assert_eq!(mir(), 42);
panic!("exit");
}