Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upNew Lint: use of built-in (or prelude) type as identifier #2676
Comments
phansch
added
L-lint
A-correctness
labels
Apr 21, 2018
This comment has been minimized.
This comment has been minimized.
MajorBreakfast
commented
May 11, 2018
•
|
I think that there should be a warning whenever a binding is created that shadows a type in general. This has got to be accidental in 99.9% of all cases! let u32 = 42i32; // No warningThis might even make sense to put into the compiler directly. |
This comment has been minimized.
This comment has been minimized.
vks
commented
Aug 16, 2018
The standard library contains modules that share a name with primitives. Other libraries might want to do the same. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
scottmcm commentedApr 17, 2018
•
edited
This compiles today, but doesn't do what many expect:
https://play.rust-lang.org/?gist=2b9bb2b1e25b5a9d85c7adecf301fd22&version=stable
It would be nice if that gave a lint like "variable/module/function/macro
u32has the same name as a built-in type". Could possibly also apply to things likelet Vec = 4;too, but I suspect that's less likely because of casing conventions.cc https://internals.rust-lang.org/t/random-musings-types-in-patterns/7316/9?u=scottmcm
cc https://github.com/rust-lang/rust/blob/9da2112238c565a7e36ada0a1f9c899961910131/src/test/run-pass/weird-exprs.rs#L87-L104