Today I found that the following program prints 92
fn main() {
let x: i32 = 92;
{
const x: i32 = 42;
println!("{}", x);
}
}
This happens because const
is an item and the reference says “it is otherwise identical in meaning to declaring the item outside the statement block.”.
Is this behavior intentional?