I can only rebind a variable that is explicitly declared as mutable; cool.
fn main() {
let mut x: int = 5;
x = 10i;
println!("value of x: {}", x); // -> 10
}
However, I'm guessing this would be redeclaring the same variable (?), which does NOT trigger a compiler error.
fn main() {
let x: int = 5;
println!("value of x: {}", x); // -> 5
let x: int = 10;
println!("value of x: {}", x); // -> 10
}
Is this intentional in Rust?