Because it was initially supported and never removed:
It’s more like we never forbade shadowing, since it just fell out of the implementation of the compiler.
As I recall, Graydon floated the idea of forbidding shadowing, but I stuck up for the feature, nobody else really cared, and so it stayed.
– pcwalton
See also:
- RFC 459: Disallow type/lifetime parameter shadowing
- What does ‘let x = x’ do in Rust?
- Why do I need rebinding/shadowing when I can have mutable variable binding?
- In Rust, what’s the difference between “shadowing” and “mutability”?