-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Warn on shadowing built-in types #36046
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Should report an issue to clippy in case they don’t already have such a lint instead. |
Since this code is also a compile error, I believe clippy can't help. |
@Wilfred Sure it can. Purely syntactic lints are run before type checking. This had already been reported on Clippy: https://github.com/Manishearth/rust-clippy/issues/949. I implemented it: https://github.com/Manishearth/rust-clippy/pull/1199. |
Aha, this is well-trodden ground then. I'm going to close as a duplicate of #35030. Huge thanks for implementing it in clippy! I did not know clippy could help with code that can't compile. |
I got a little confused by the following code:
rustc gives the error:
42: expected type parameter, found integral variable
.The mistake is that I've created a type parameter named
u32
. Could we warn on this case? I can't see any legitimate use case for shadowingu32
.The text was updated successfully, but these errors were encountered: