Planned Deprecation of un/signed integer types?

Heyho rusticans,

newbie here :wave: While I was scrolling through my local documentation - because I'm currently off grid - I encountered this weird tags on all Constants for the un/signed integer type "Deprecation planned" in the std module. So I checked online and it's exactly the same.

Afterwards I did some research, but couldn't get behind why they are marked like this.

Can anyone explain it to me, because it seems like this deprecation is only planned for integers, floats somehow stay the way they are? Is Rust going all Float? :business_suit_levitating:


No, deprecation of the core::{type} modules, not the types :grin:

Constants from these modules will be turned to associated consts on types.

P.S. Rustaceans)

The constants in the top level primitive modules in std (u32, usize, f32, f64, etc.) were implemented as a sort of temporary workaround for the lack of associated constants on types in rust 1.0

The primitive types already have those constants as associated constants which you can see on the documentation for the primitive types themselves. Here's u32::MAX for example, which is different from std::u32::MAX. (The values are the same obviously but they refer to different items)

Also note the basic constants are still marked as deprecated in the floating point types' modules. It looks like the floating point types' modules have some additional constants in a submodule that can be useful for floating point math, so presumably those modules aren't deprecated because those constants haven't been moved.

You can read more about how this situation happened and how it's being fixed in the RFC that proposed deprecating those constants.

Now I got it, it's just the deduplication of constants from the core/std crates into the unified primitive types and I feel kinda dumb I didn't get this yesterday - must have been too late (◡ ω ◡)

Thanks to both of you Rustaceans!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.