Copy
特質を持たない変数をコピーすると、所有権の移動が発生し、コピー元の変数は使用が不可能になる。
let s1 = String::from("hello");
let s2 = s1;
println!("{}", s1); //error
/*
error[E0382]: borrow of moved value: `s1`
--> src\main.rs:5:16
|
3 | let s1 = String::from("hello");
| -- move occurs because `s1` has type `String`, which does not implement the `Copy` trait
4 | let s2 = s1;
| -- value moved here
5 | println!("{}", s1); //hello
| ^^ value borrowed here after move
*/