Description
The documentation says
static MONSTER_FACTOR: float = 57.8;
let monster_size = MONSTER_FACTOR * 10.0;
let monster_size: int = 50;
Local variables may shadow earlier declarations, as in the previous example: > monster_size was first declared as a float, and then a second monster_size
was declared as an int. If you were to actually compile this example, though,
the compiler would determine that the first monster_size is unused and issue a > warning (because this situation is likely to indicate a programmer error)
but trying to compile
fn main() {
static monster_factor: float = 10;
let monster_size = monster_factor * 10.0;
let monster_size: int = 50;
println(fmt!("Number : %d\n", monster_size));
}
gives me
noufal@sanitarium% rust run trial0.rs
trial0.rs:2:35: 2:37 error: mismatched types: expectedfloat
but found<VI0>
> (expected float but found integral variable)
trial0.rs:2 static monster_factor: float = 10;
^~
error: aborting due to previous error
Based on the docs, I'd expect a warning about the unused variable rather than an error.