diff options
| author | bors <bors@rust-lang.org> | 2023-11-11 21:12:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-11-11 21:12:20 +0000 |
| commit | 2c1b65ee1431f8d3fe2142e821eb13c623bbf8a0 (patch) | |
| tree | 309f710af9b252a81b42bac06de80552453ac75d /library/std/src/lib.rs | |
| parent | ed086d86b8b224f7df2da09cf48ac2a654bf841e (diff) | |
| parent | 8337e86b28b9cdab7250e39710a1c81b99aeeb8d (diff) | |
| download | rust-2c1b65ee1431f8d3fe2142e821eb13c623bbf8a0.tar.gz rust-2c1b65ee1431f8d3fe2142e821eb13c623bbf8a0.zip | |
Auto merge of #115694 - clarfonthey:std-hash-private, r=dtolnay
Add `std::hash::{DefaultHasher, RandomState}` exports (needs FCP)
This implements rust-lang/libs-team#267 to move the libstd hasher types to `std::hash` where they belong, instead of `std::collections::hash_map`.
<details><summary>The below no longer applies, but is kept for clarity.</summary>
This is a small refactor for #27242, which moves the definitions of `RandomState` and `DefaultHasher` into `std::hash`, but in a way that won't be noticed in the public API.
I've opened rust-lang/libs-team#267 as a formal ACP to move these directly into the root of `std::hash`, but for now, they're at least separated out from the collections code in a way that will make moving that around easier.
I decided to simply copy the rustdoc for `std::hash` from `core::hash` since I think it would be ideal for the two to diverge longer-term, especially if the ACP is accepted. However, I would be willing to factor them out into a common markdown document if that's preferred.
</details>
Diffstat (limited to 'library/std/src/lib.rs')
| -rw-r--r-- | library/std/src/lib.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/library/std/src/lib.rs b/library/std/src/lib.rs index 42589012257..f716c0fe922 100644 --- a/library/std/src/lib.rs +++ b/library/std/src/lib.rs @@ -494,8 +494,6 @@ pub use core::convert; pub use core::default; #[stable(feature = "futures_api", since = "1.36.0")] pub use core::future; -#[stable(feature = "rust1", since = "1.0.0")] -pub use core::hash; #[stable(feature = "core_hint", since = "1.27.0")] pub use core::hint; #[stable(feature = "i128", since = "1.26.0")] @@ -565,6 +563,7 @@ pub mod env; pub mod error; pub mod ffi; pub mod fs; +pub mod hash; pub mod io; pub mod net; pub mod num; @@ -716,7 +715,7 @@ pub(crate) mod test_helpers { #[track_caller] pub(crate) fn test_rng() -> rand_xorshift::XorShiftRng { use core::hash::{BuildHasher, Hash, Hasher}; - let mut hasher = crate::collections::hash_map::RandomState::new().build_hasher(); + let mut hasher = crate::hash::RandomState::new().build_hasher(); core::panic::Location::caller().hash(&mut hasher); let hc64 = hasher.finish(); let seed_vec = hc64.to_le_bytes().into_iter().chain(0u8..8).collect::<Vec<u8>>(); |
