1
Fork 0
rust/tests/ui/mir/mir_drop_panics.rs

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

25 lines
377 B
Rust
Raw Normal View History

2020-04-16 15:50:32 +09:00
// run-fail
// needs-unwind
// error-pattern:panic 1
// error-pattern:drop 2
struct Droppable(u32);
impl Drop for Droppable {
fn drop(&mut self) {
if self.0 == 1 {
panic!("panic 1");
} else {
eprintln!("drop {}", self.0);
}
}
}
fn mir() {
let x = Droppable(2);
let y = Droppable(1);
}
fn main() {
mir();
}