Using primitive types from core or std

Hi. I'm learning Rust these days and have a (maybe stupid) question:
Where are the primitive types (isize, bool, ...) originally defined, in core or std lib?
In the docs it looks like they are implemented twice, but I think one library uses the implementation of the other. So: Which library should better be used e. g. for associated methods and constants like isize::MAX?
An what means the note "Deprecation planned" by the primitives in std?

Thanks for help!

Primitive types are compiler built-in types. They aren't defined in the standard library but are part of the language. Methods, associated functions and constants for primitive types are all implemented in core, I believe. std re-exports core, including these impls for primitive types.

I'm not sure I understand what you mean. Do you have a link to where this is stated?

I think they saw

std - Rust // search for "Deprecation planned" and

1 Like

More on https://stackoverflow.com/questions/70946249/why-will-rust-integer-types-be-deprecated-soon

Ah yes, thank you. Well, the ::core::isize and ::std::isize modules are deprecated in favour of the assoicated constants isize::MAX and isize::MIN. So newly developed code should prefer using these.

1 Like

Okay, thank you.

Nit: most methods are. Some however are defined in std, for example numerical methods like sin and cos on floating point types.

3 Likes