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) {
|
2017-09-24 23:14:56 -05:00
|
|
|
eprintln!("dropped");
|
2015-12-21 10:58:18 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// return value of this function is copied into the return slot
|
|
|
|
fn complex() -> u64 {
|
2017-09-24 23:14:56 -05:00
|
|
|
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");
|
|
|
|
}
|