Re: [rust-dev] no warnings about variable redeclarations: feature or bug?

2013-02-16 Thread Tim Chevalier
This is a feature. The Rust compiler uses name shadowing a fair amount. It's imaginable to have a lint pass about it that's off by default, though I don't think we have a lint pass like that now. (In Haskell, for example, name shadowing is allowed but GHC has an optional warning flag that will warn

Re: [rust-dev] no warnings about variable redeclarations: feature or bug?

2013-02-16 Thread Patrick Walton
On 2/16/13 3:38 PM, Chris Peterson wrote: Is this a feature or a bug? The Rust manual has no comment. This behavior was surprising, but I actually it. I use a similar pattern in Python when transforming a variable to a different type. I don't want to make up a new (and uglier) name when I no lon

[rust-dev] no warnings about variable redeclarations: feature or bug?

2013-02-16 Thread Chris Peterson
The following code snippet does not emit any compilation warnings about redeclaring variable names or types: fn x(y: int) -> ~str { let y = y + 1; let x = y == 2; let x = x.to_str(); x } Is this a feature or a bug? The Rust manual has no comment. This beha