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