mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
25 lines
381 B
Rust
25 lines
381 B
Rust
//@ 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();
|
|
}
|