Why doesnt x get moved here? Should the last println even compile?
fn main() {
let x = 5;
{
let x = x * 2;
println!("inner scope {x}");
}
println!("outer scope {x}");
}
\-- Output -- inner scope 10 outer scope 5
// edit
You guys are right. Integers have the Copy trait. Tried it with a String and it didn't compile: Snippet
Snippet with cloning (compiles)