我不明白下面的 rust 代码如何释放这些变量。
struct A(&'static str);
impl A {
fn as_ref(&self) -> &Self { &self }
}
impl Drop for A {
fn drop(&mut self) {
print!("{}", self.0);
}
}
fn main() {
let a = A("X");
let a = A("Y").as_ref();
print!("Z");
}
这最后为什么会打印YZX呢?