A struct holds two fields, both of which implement Drop. The struct itself also implements Drop. When an instance goes out of scope, in what order do the destructors actually run?
struct Inner(&'static str);
impl Drop for Inner {
fn drop(&mut self) { println!("drop {}", self.0); }
}
struct Outer { a: Inner, b: Inner }
impl Drop for Outer {
fn drop(&mut self) { println!("drop Outer"); }
}
fn main() {
let _o = Outer { a: Inner("a"), b: Inner("b") };
}