A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-122.rs
1fnmain(){
2leta=String::from("data");
3letb=a.clone();
4letc=a;
5println!("{} {}",b,c);
6}
Ownership
Answer & explanation
Console output
data data
Why
b is a deep clone, so a remains valid afterward; then let c = a moves the original into c. Both b and c own their own "data" buffers, so printing them yields "data data". Cloning before moving is a common way to keep two owners.