Skip to content

Commit

Permalink
Mark deprecated unstable SipHasher13 as a doc-hidden impl detail of H…
Browse files Browse the repository at this point in the history
…ashMap.

It stays in libcore rather than being private in HashMap’s module
because it shares code with the deprecated *stable* `SipHasher` type.
  • Loading branch information
SimonSapin committed Mar 17, 2018
1 parent c5f020a commit 89ecb0d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/libcore/hash/mod.rs
Expand Up @@ -99,8 +99,9 @@ use mem;
#[allow(deprecated)]
pub use self::sip::SipHasher;

#[unstable(feature = "sip_hash_13", issue = "34767")]
#[unstable(feature = "hashmap_internals", issue = "0")]
#[allow(deprecated)]
#[doc(hidden)]
pub use self::sip::SipHasher13;

mod sip;
Expand Down
11 changes: 6 additions & 5 deletions src/libcore/hash/sip.rs
Expand Up @@ -23,18 +23,19 @@ use mem;
/// (eg. `collections::HashMap` uses it by default).
///
/// See: <https://131002.net/siphash>
#[unstable(feature = "sip_hash_13", issue = "34767")]
#[unstable(feature = "hashmap_internals", issue = "0")]
#[rustc_deprecated(since = "1.13.0",
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
#[derive(Debug, Clone, Default)]
#[doc(hidden)]
pub struct SipHasher13 {
hasher: Hasher<Sip13Rounds>,
}

/// An implementation of SipHash 2-4.
///
/// See: <https://131002.net/siphash/>
#[unstable(feature = "sip_hash_13", issue = "34767")]
#[unstable(feature = "hashmap_internals", issue = "0")]
#[rustc_deprecated(since = "1.13.0",
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
#[derive(Debug, Clone, Default)]
Expand Down Expand Up @@ -165,7 +166,7 @@ impl SipHasher {
impl SipHasher13 {
/// Creates a new `SipHasher13` with the two initial keys set to 0.
#[inline]
#[unstable(feature = "sip_hash_13", issue = "34767")]
#[unstable(feature = "hashmap_internals", issue = "0")]
#[rustc_deprecated(since = "1.13.0",
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
pub fn new() -> SipHasher13 {
Expand All @@ -174,7 +175,7 @@ impl SipHasher13 {

/// Creates a `SipHasher13` that is keyed off the provided keys.
#[inline]
#[unstable(feature = "sip_hash_13", issue = "34767")]
#[unstable(feature = "hashmap_internals", issue = "0")]
#[rustc_deprecated(since = "1.13.0",
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
pub fn new_with_keys(key0: u64, key1: u64) -> SipHasher13 {
Expand Down Expand Up @@ -260,7 +261,7 @@ impl super::Hasher for SipHasher {
}
}

#[unstable(feature = "sip_hash_13", issue = "34767")]
#[unstable(feature = "hashmap_internals", issue = "0")]
impl super::Hasher for SipHasher13 {
#[inline]
fn write(&mut self, msg: &[u8]) {
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/tests/lib.rs
Expand Up @@ -21,6 +21,7 @@
#![feature(fixed_size_array)]
#![feature(flt2dec)]
#![feature(fmt_internals)]
#![feature(hashmap_internals)]
#![feature(iterator_step_by)]
#![feature(i128_type)]
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
Expand All @@ -35,7 +36,6 @@
#![feature(range_is_empty)]
#![feature(raw)]
#![feature(refcell_replace_swap)]
#![feature(sip_hash_13)]
#![feature(slice_patterns)]
#![feature(sort_internals)]
#![feature(specialization)]
Expand Down
3 changes: 1 addition & 2 deletions src/libstd/lib.rs
Expand Up @@ -267,7 +267,7 @@
#![feature(fn_traits)]
#![feature(fnbox)]
#![feature(generic_param_attrs)]
#![feature(hashmap_hasher)]
#![feature(hashmap_internals)]
#![feature(heap_api)]
#![feature(i128)]
#![feature(i128_type)]
Expand Down Expand Up @@ -298,7 +298,6 @@
#![feature(raw)]
#![feature(rustc_attrs)]
#![feature(stdsimd)]
#![feature(sip_hash_13)]
#![feature(slice_bytes)]
#![feature(slice_concat_ext)]
#![feature(slice_internals)]
Expand Down

0 comments on commit 89ecb0d

Please sign in to comment.