remove #[deprecated] from unstable & internal SipHasher13&24

This commit is contained in:
cyrgani
2026-01-19 21:24:36 +00:00
parent f548a19d49
commit 0adf24ac20
4 changed files with 7 additions and 17 deletions
+1 -5
View File
@@ -3,9 +3,7 @@
use alloc::sync::Arc;
use core::assert_matches::assert_matches;
use core::ffi::{CStr, FromBytesUntilNulError, c_char};
#[allow(deprecated)]
use core::hash::SipHasher13 as DefaultHasher;
use core::hash::{Hash, Hasher};
use core::hash::{Hash, Hasher, SipHasher13 as DefaultHasher};
#[test]
fn c_to_rust() {
@@ -57,11 +55,9 @@ fn equal_hash() {
let ptr = data.as_ptr() as *const c_char;
let cstr: &'static CStr = unsafe { CStr::from_ptr(ptr) };
#[allow(deprecated)]
let mut s = DefaultHasher::new();
cstr.hash(&mut s);
let cstr_hash = s.finish();
#[allow(deprecated)]
let mut s = DefaultHasher::new();
CString::new(&data[..data.len() - 1]).unwrap().hash(&mut s);
let cstring_hash = s.finish();
-1
View File
@@ -87,7 +87,6 @@
#[allow(deprecated)]
pub use self::sip::SipHasher;
#[unstable(feature = "hashmap_internals", issue = "none")]
#[allow(deprecated)]
#[doc(hidden)]
pub use self::sip::SipHasher13;
use crate::{fmt, marker};
+6 -7
View File
@@ -11,8 +11,11 @@
/// (e.g., `collections::HashMap` uses it by default).
///
/// See: <https://github.com/veorq/SipHash>
#[unstable(feature = "hashmap_internals", issue = "none")]
#[deprecated(since = "1.13.0", note = "use `std::hash::DefaultHasher` instead")]
#[unstable(
feature = "hashmap_internals",
issue = "none",
reason = "use `std::hash::DefaultHasher` instead"
)]
#[derive(Debug, Clone, Default)]
#[doc(hidden)]
pub struct SipHasher13 {
@@ -23,7 +26,6 @@ pub struct SipHasher13 {
///
/// See: <https://github.com/veorq/SipHash>
#[unstable(feature = "hashmap_internals", issue = "none")]
#[deprecated(since = "1.13.0", note = "use `std::hash::DefaultHasher` instead")]
#[derive(Debug, Clone, Default)]
struct SipHasher24 {
hasher: Hasher<Sip24Rounds>,
@@ -137,8 +139,7 @@ unsafe fn u8to64_le(buf: &[u8], start: usize, len: usize) -> u64 {
out |= (unsafe { *buf.get_unchecked(start + i) } as u64) << (i * 8);
i += 1;
}
//FIXME(fee1-dead): use debug_assert_eq
debug_assert!(i == len);
debug_assert_eq!(i, len);
out
}
@@ -167,7 +168,6 @@ impl SipHasher13 {
#[inline]
#[unstable(feature = "hashmap_internals", issue = "none")]
#[rustc_const_unstable(feature = "const_default", issue = "143894")]
#[deprecated(since = "1.13.0", note = "use `std::hash::DefaultHasher` instead")]
pub const fn new() -> SipHasher13 {
SipHasher13::new_with_keys(0, 0)
}
@@ -176,7 +176,6 @@ pub const fn new() -> SipHasher13 {
#[inline]
#[unstable(feature = "hashmap_internals", issue = "none")]
#[rustc_const_unstable(feature = "const_default", issue = "143894")]
#[deprecated(since = "1.13.0", note = "use `std::hash::DefaultHasher` instead")]
pub const fn new_with_keys(key0: u64, key1: u64) -> SipHasher13 {
SipHasher13 { hasher: Hasher::new_with_keys(key0, key1) }
}
-4
View File
@@ -7,7 +7,6 @@
//!
//! [`collections`]: crate::collections
#[allow(deprecated)]
use super::{BuildHasher, Hasher, SipHasher13};
use crate::cell::Cell;
use crate::fmt;
@@ -81,7 +80,6 @@ pub fn new() -> RandomState {
impl BuildHasher for RandomState {
type Hasher = DefaultHasher;
#[inline]
#[allow(deprecated)]
fn build_hasher(&self) -> DefaultHasher {
DefaultHasher(SipHasher13::new_with_keys(self.k0, self.k1))
}
@@ -91,7 +89,6 @@ fn build_hasher(&self) -> DefaultHasher {
///
/// The internal algorithm is not specified, and so it and its hashes should
/// not be relied upon over releases.
#[allow(deprecated)]
#[derive(Clone, Debug)]
#[stable(feature = "hashmap_build_hasher", since = "1.7.0")]
pub struct DefaultHasher(SipHasher13);
@@ -104,7 +101,6 @@ impl DefaultHasher {
/// instances created through `new` or `default`.
#[stable(feature = "hashmap_default_hasher", since = "1.13.0")]
#[inline]
#[allow(deprecated)]
#[rustc_const_unstable(feature = "const_default", issue = "143894")]
#[must_use]
pub const fn new() -> DefaultHasher {