3 ms·
This would imply that the variable can get its value back once the new binding is out of scope. But that is not the case as this doesn't compile: let s1 =
by fauigerzigerk 3y ago
This would imply that the variable can get its value back once the new binding is out of scope. But that is not the case as this doesn't compile:
let s1 = String::from("abc");
{
let s2 = s1;
}
println!("{}", s1); //borrow of moved value: `s1`
But I do understand what you're getting at. In a sense, a move is not a runtime concept at all. The compiler simply considers the variable as no longer readable unless and until a new value is actually written to it.