我正在寻找有关引用和可变引用类型的复制/移动语义的文档.
下面的代码片段显示了实现Copy
特性的不可变引用(& T
)和不实现Copy
特性的可变引用(&mut T
).
struct T;
fn copyable<U>(_: U) where U: Copy {}
fn main() {
let a = &T;
copyable(a); // OK
let b = &mut T;
copyable(b);
// error: the trait `core::marker::Copy` is not implemented for the type `&mut T`
}
但我找不到这种行为的描述.有人知道一些(联合国)官方文件吗?(还是我错了?)