Glob imports can shadow built-in types

I had that thought too. It might not be a bad plan down the road but I would want to get some experience with bignum APIs in ordinary crates before baking one into the compiler. I have the impression that that hasn't happened yet.

That was my first reaction as well, but after thinking about it some more I don't think it's actually a problem. If you define a private struct i32 (or a variable, or whatever) in your own code it only affects you. If you export pub struct i32 from your crate it only affects clients that do use weird::i32 (in which case they know what they're doing) or use weird::* which is already discouraged, and the consequences are no worse than getting the core Option or Box shadowed unexpectedly.

I can even think of legitimate uses. use checked_integer_overflow::prelude::* anyone?

7 Likes