从implementation of pin_mut!人起,有
...
// Move the value to ensure that it is owned
let mut $x = $x;
...
go 掉这个代码,原来的$x
仍然笼罩在阴影中,所以把$x
搬到这里的用意就是"移动价值,确保它被拥有".
然而,我想知道为什么这是必要的?我发现如果我们不能一成不变地借到$x
英镑,下面的代码就会触发.
...
let mut $x = unsafe {
$crate::core_reexport::pin::Pin::new_unchecked(&mut $x)
};
...
这个宏的定义不能接受pin_mut!(&mut x)
.
那么,let mut $x = $x
会在什么情况下单独开火呢?