Skip to content

Commit aafe7d8

Browse files
committed
Auto merge of rust-lang#49108 - SimonSapin:sip, r=TimNN
Remove or hide deprecated unstable SipHasher{13,24} Deprecated since Rust 1.13.0.
2 parents 15add36 + 89ecb0d commit aafe7d8

File tree

5 files changed

+23
-55
lines changed

5 files changed

+23
-55
lines changed

src/libcore/hash/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,10 @@ use mem;
9999
#[allow(deprecated)]
100100
pub use self::sip::SipHasher;
101101

102-
#[unstable(feature = "sip_hash_13", issue = "34767")]
102+
#[unstable(feature = "hashmap_internals", issue = "0")]
103103
#[allow(deprecated)]
104-
pub use self::sip::{SipHasher13, SipHasher24};
104+
#[doc(hidden)]
105+
pub use self::sip::SipHasher13;
105106

106107
mod sip;
107108

src/libcore/hash/sip.rs

+12-44
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,23 @@ use mem;
2323
/// (eg. `collections::HashMap` uses it by default).
2424
///
2525
/// See: <https://131002.net/siphash>
26-
#[unstable(feature = "sip_hash_13", issue = "34767")]
26+
#[unstable(feature = "hashmap_internals", issue = "0")]
2727
#[rustc_deprecated(since = "1.13.0",
2828
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
2929
#[derive(Debug, Clone, Default)]
30+
#[doc(hidden)]
3031
pub struct SipHasher13 {
3132
hasher: Hasher<Sip13Rounds>,
3233
}
3334

3435
/// An implementation of SipHash 2-4.
3536
///
3637
/// See: <https://131002.net/siphash/>
37-
#[unstable(feature = "sip_hash_13", issue = "34767")]
38+
#[unstable(feature = "hashmap_internals", issue = "0")]
3839
#[rustc_deprecated(since = "1.13.0",
3940
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
4041
#[derive(Debug, Clone, Default)]
41-
pub struct SipHasher24 {
42+
struct SipHasher24 {
4243
hasher: Hasher<Sip24Rounds>,
4344
}
4445

@@ -156,14 +157,16 @@ impl SipHasher {
156157
#[rustc_deprecated(since = "1.13.0",
157158
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
158159
pub fn new_with_keys(key0: u64, key1: u64) -> SipHasher {
159-
SipHasher(SipHasher24::new_with_keys(key0, key1))
160+
SipHasher(SipHasher24 {
161+
hasher: Hasher::new_with_keys(key0, key1)
162+
})
160163
}
161164
}
162165

163166
impl SipHasher13 {
164167
/// Creates a new `SipHasher13` with the two initial keys set to 0.
165168
#[inline]
166-
#[unstable(feature = "sip_hash_13", issue = "34767")]
169+
#[unstable(feature = "hashmap_internals", issue = "0")]
167170
#[rustc_deprecated(since = "1.13.0",
168171
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
169172
pub fn new() -> SipHasher13 {
@@ -172,7 +175,7 @@ impl SipHasher13 {
172175

173176
/// Creates a `SipHasher13` that is keyed off the provided keys.
174177
#[inline]
175-
#[unstable(feature = "sip_hash_13", issue = "34767")]
178+
#[unstable(feature = "hashmap_internals", issue = "0")]
176179
#[rustc_deprecated(since = "1.13.0",
177180
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
178181
pub fn new_with_keys(key0: u64, key1: u64) -> SipHasher13 {
@@ -182,28 +185,6 @@ impl SipHasher13 {
182185
}
183186
}
184187

185-
impl SipHasher24 {
186-
/// Creates a new `SipHasher24` with the two initial keys set to 0.
187-
#[inline]
188-
#[unstable(feature = "sip_hash_13", issue = "34767")]
189-
#[rustc_deprecated(since = "1.13.0",
190-
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
191-
pub fn new() -> SipHasher24 {
192-
SipHasher24::new_with_keys(0, 0)
193-
}
194-
195-
/// Creates a `SipHasher24` that is keyed off the provided keys.
196-
#[inline]
197-
#[unstable(feature = "sip_hash_13", issue = "34767")]
198-
#[rustc_deprecated(since = "1.13.0",
199-
reason = "use `std::collections::hash_map::DefaultHasher` instead")]
200-
pub fn new_with_keys(key0: u64, key1: u64) -> SipHasher24 {
201-
SipHasher24 {
202-
hasher: Hasher::new_with_keys(key0, key1)
203-
}
204-
}
205-
}
206-
207188
impl<S: Sip> Hasher<S> {
208189
#[inline]
209190
fn new_with_keys(key0: u64, key1: u64) -> Hasher<S> {
@@ -271,16 +252,16 @@ impl<S: Sip> Hasher<S> {
271252
impl super::Hasher for SipHasher {
272253
#[inline]
273254
fn write(&mut self, msg: &[u8]) {
274-
self.0.write(msg)
255+
self.0.hasher.write(msg)
275256
}
276257

277258
#[inline]
278259
fn finish(&self) -> u64 {
279-
self.0.finish()
260+
self.0.hasher.finish()
280261
}
281262
}
282263

283-
#[unstable(feature = "sip_hash_13", issue = "34767")]
264+
#[unstable(feature = "hashmap_internals", issue = "0")]
284265
impl super::Hasher for SipHasher13 {
285266
#[inline]
286267
fn write(&mut self, msg: &[u8]) {
@@ -293,19 +274,6 @@ impl super::Hasher for SipHasher13 {
293274
}
294275
}
295276

296-
#[unstable(feature = "sip_hash_13", issue = "34767")]
297-
impl super::Hasher for SipHasher24 {
298-
#[inline]
299-
fn write(&mut self, msg: &[u8]) {
300-
self.hasher.write(msg)
301-
}
302-
303-
#[inline]
304-
fn finish(&self) -> u64 {
305-
self.hasher.finish()
306-
}
307-
}
308-
309277
impl<S: Sip> super::Hasher for Hasher<S> {
310278
// see short_write comment for explanation
311279
#[inline]

src/libcore/tests/hash/sip.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#![allow(deprecated)]
1212

1313
use core::hash::{Hash, Hasher};
14-
use core::hash::{SipHasher, SipHasher13, SipHasher24};
14+
use core::hash::{SipHasher, SipHasher13};
1515
use core::{slice, mem};
1616

1717
// Hash just the bytes of the slice, without length prefix
@@ -224,14 +224,14 @@ fn test_siphash_2_4() {
224224
let k1 = 0x_0f_0e_0d_0c_0b_0a_09_08;
225225
let mut buf = Vec::new();
226226
let mut t = 0;
227-
let mut state_inc = SipHasher24::new_with_keys(k0, k1);
227+
let mut state_inc = SipHasher::new_with_keys(k0, k1);
228228

229229
while t < 64 {
230230
let vec = u8to64_le!(vecs[t], 0);
231-
let out = hash_with(SipHasher24::new_with_keys(k0, k1), &Bytes(&buf));
231+
let out = hash_with(SipHasher::new_with_keys(k0, k1), &Bytes(&buf));
232232
assert_eq!(vec, out);
233233

234-
let full = hash_with(SipHasher24::new_with_keys(k0, k1), &Bytes(&buf));
234+
let full = hash_with(SipHasher::new_with_keys(k0, k1), &Bytes(&buf));
235235
let i = state_inc.finish();
236236

237237
assert_eq!(full, i);
@@ -322,13 +322,13 @@ fn test_hash_no_concat_alias() {
322322
#[test]
323323
fn test_write_short_works() {
324324
let test_usize = 0xd0c0b0a0usize;
325-
let mut h1 = SipHasher24::new();
325+
let mut h1 = SipHasher::new();
326326
h1.write_usize(test_usize);
327327
h1.write(b"bytes");
328328
h1.write(b"string");
329329
h1.write_u8(0xFFu8);
330330
h1.write_u8(0x01u8);
331-
let mut h2 = SipHasher24::new();
331+
let mut h2 = SipHasher::new();
332332
h2.write(unsafe {
333333
slice::from_raw_parts(&test_usize as *const _ as *const u8,
334334
mem::size_of::<usize>())

src/libcore/tests/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#![feature(fixed_size_array)]
2222
#![feature(flt2dec)]
2323
#![feature(fmt_internals)]
24+
#![feature(hashmap_internals)]
2425
#![feature(iterator_step_by)]
2526
#![feature(i128_type)]
2627
#![cfg_attr(stage0, feature(inclusive_range_syntax))]
@@ -35,7 +36,6 @@
3536
#![feature(range_is_empty)]
3637
#![feature(raw)]
3738
#![feature(refcell_replace_swap)]
38-
#![feature(sip_hash_13)]
3939
#![feature(slice_patterns)]
4040
#![feature(sort_internals)]
4141
#![feature(specialization)]

src/libstd/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@
267267
#![feature(fn_traits)]
268268
#![feature(fnbox)]
269269
#![feature(generic_param_attrs)]
270-
#![feature(hashmap_hasher)]
270+
#![feature(hashmap_internals)]
271271
#![feature(heap_api)]
272272
#![feature(i128)]
273273
#![feature(i128_type)]
@@ -298,7 +298,6 @@
298298
#![feature(raw)]
299299
#![feature(rustc_attrs)]
300300
#![feature(stdsimd)]
301-
#![feature(sip_hash_13)]
302301
#![feature(slice_bytes)]
303302
#![feature(slice_concat_ext)]
304303
#![feature(slice_internals)]

0 commit comments

Comments
 (0)