mirror of
https://github.com/rust-lang/rust.git
synced 2025-06-05 19:58:32 +00:00
Added const_hash
tracking issue id
This commit is contained in:
parent
5f9899b289
commit
dc1f1a8e97
@ -567,7 +567,7 @@ pub trait Hasher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "indirect_hasher_impl", since = "1.22.0")]
|
#[stable(feature = "indirect_hasher_impl", since = "1.22.0")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl<H: ~const Hasher + ?Sized> const Hasher for &mut H {
|
impl<H: ~const Hasher + ?Sized> const Hasher for &mut H {
|
||||||
fn finish(&self) -> u64 {
|
fn finish(&self) -> u64 {
|
||||||
(**self).finish()
|
(**self).finish()
|
||||||
@ -776,7 +776,7 @@ impl<H> fmt::Debug for BuildHasherDefault<H> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable(since = "1.7.0", feature = "build_hasher")]
|
#[stable(since = "1.7.0", feature = "build_hasher")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl<H: ~const Default + Hasher> const BuildHasher for BuildHasherDefault<H> {
|
impl<H: ~const Default + Hasher> const BuildHasher for BuildHasherDefault<H> {
|
||||||
type Hasher = H;
|
type Hasher = H;
|
||||||
|
|
||||||
@ -819,7 +819,7 @@ mod impls {
|
|||||||
macro_rules! impl_write {
|
macro_rules! impl_write {
|
||||||
($(($ty:ident, $meth:ident),)*) => {$(
|
($(($ty:ident, $meth:ident),)*) => {$(
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl const Hash for $ty {
|
impl const Hash for $ty {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn hash<H: ~const Hasher>(&self, state: &mut H) {
|
fn hash<H: ~const Hasher>(&self, state: &mut H) {
|
||||||
@ -856,7 +856,7 @@ mod impls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl const Hash for bool {
|
impl const Hash for bool {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn hash<H: ~const Hasher>(&self, state: &mut H) {
|
fn hash<H: ~const Hasher>(&self, state: &mut H) {
|
||||||
@ -865,7 +865,7 @@ mod impls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl const Hash for char {
|
impl const Hash for char {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn hash<H: ~const Hasher>(&self, state: &mut H) {
|
fn hash<H: ~const Hasher>(&self, state: &mut H) {
|
||||||
@ -874,7 +874,7 @@ mod impls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl const Hash for str {
|
impl const Hash for str {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn hash<H: ~const Hasher>(&self, state: &mut H) {
|
fn hash<H: ~const Hasher>(&self, state: &mut H) {
|
||||||
@ -883,7 +883,7 @@ mod impls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "never_hash", since = "1.29.0")]
|
#[stable(feature = "never_hash", since = "1.29.0")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl const Hash for ! {
|
impl const Hash for ! {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn hash<H: ~const Hasher>(&self, _: &mut H) {
|
fn hash<H: ~const Hasher>(&self, _: &mut H) {
|
||||||
@ -894,7 +894,7 @@ mod impls {
|
|||||||
macro_rules! impl_hash_tuple {
|
macro_rules! impl_hash_tuple {
|
||||||
() => (
|
() => (
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl const Hash for () {
|
impl const Hash for () {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn hash<H: ~const Hasher>(&self, _state: &mut H) {}
|
fn hash<H: ~const Hasher>(&self, _state: &mut H) {}
|
||||||
@ -905,7 +905,7 @@ mod impls {
|
|||||||
maybe_tuple_doc! {
|
maybe_tuple_doc! {
|
||||||
$($name)+ @
|
$($name)+ @
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl<$($name: ~const Hash),+> const Hash for ($($name,)+) where last_type!($($name,)+): ?Sized {
|
impl<$($name: ~const Hash),+> const Hash for ($($name,)+) where last_type!($($name,)+): ?Sized {
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -952,7 +952,7 @@ mod impls {
|
|||||||
impl_hash_tuple! { T B C D E F G H I J K L }
|
impl_hash_tuple! { T B C D E F G H I J K L }
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl<T: ~const Hash> const Hash for [T] {
|
impl<T: ~const Hash> const Hash for [T] {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn hash<H: ~const Hasher>(&self, state: &mut H) {
|
fn hash<H: ~const Hasher>(&self, state: &mut H) {
|
||||||
@ -962,7 +962,7 @@ mod impls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl<T: ?Sized + ~const Hash> const Hash for &T {
|
impl<T: ?Sized + ~const Hash> const Hash for &T {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn hash<H: ~const Hasher>(&self, state: &mut H) {
|
fn hash<H: ~const Hasher>(&self, state: &mut H) {
|
||||||
@ -971,7 +971,7 @@ mod impls {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl<T: ?Sized + ~const Hash> const Hash for &mut T {
|
impl<T: ?Sized + ~const Hash> const Hash for &mut T {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn hash<H: Hasher>(&self, state: &mut H) {
|
fn hash<H: Hasher>(&self, state: &mut H) {
|
||||||
|
@ -150,7 +150,7 @@ impl SipHasher {
|
|||||||
since = "1.13.0",
|
since = "1.13.0",
|
||||||
note = "use `std::collections::hash_map::DefaultHasher` instead"
|
note = "use `std::collections::hash_map::DefaultHasher` instead"
|
||||||
)]
|
)]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn new() -> SipHasher {
|
pub const fn new() -> SipHasher {
|
||||||
SipHasher::new_with_keys(0, 0)
|
SipHasher::new_with_keys(0, 0)
|
||||||
@ -163,7 +163,7 @@ impl SipHasher {
|
|||||||
since = "1.13.0",
|
since = "1.13.0",
|
||||||
note = "use `std::collections::hash_map::DefaultHasher` instead"
|
note = "use `std::collections::hash_map::DefaultHasher` instead"
|
||||||
)]
|
)]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn new_with_keys(key0: u64, key1: u64) -> SipHasher {
|
pub const fn new_with_keys(key0: u64, key1: u64) -> SipHasher {
|
||||||
SipHasher(SipHasher24 { hasher: Hasher::new_with_keys(key0, key1) })
|
SipHasher(SipHasher24 { hasher: Hasher::new_with_keys(key0, key1) })
|
||||||
@ -178,7 +178,7 @@ impl SipHasher13 {
|
|||||||
since = "1.13.0",
|
since = "1.13.0",
|
||||||
note = "use `std::collections::hash_map::DefaultHasher` instead"
|
note = "use `std::collections::hash_map::DefaultHasher` instead"
|
||||||
)]
|
)]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
pub const fn new() -> SipHasher13 {
|
pub const fn new() -> SipHasher13 {
|
||||||
SipHasher13::new_with_keys(0, 0)
|
SipHasher13::new_with_keys(0, 0)
|
||||||
}
|
}
|
||||||
@ -190,7 +190,7 @@ impl SipHasher13 {
|
|||||||
since = "1.13.0",
|
since = "1.13.0",
|
||||||
note = "use `std::collections::hash_map::DefaultHasher` instead"
|
note = "use `std::collections::hash_map::DefaultHasher` instead"
|
||||||
)]
|
)]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
pub const fn new_with_keys(key0: u64, key1: u64) -> SipHasher13 {
|
pub const fn new_with_keys(key0: u64, key1: u64) -> SipHasher13 {
|
||||||
SipHasher13 { hasher: Hasher::new_with_keys(key0, key1) }
|
SipHasher13 { hasher: Hasher::new_with_keys(key0, key1) }
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ impl<S: Sip> Hasher<S> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl const super::Hasher for SipHasher {
|
impl const super::Hasher for SipHasher {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn write(&mut self, msg: &[u8]) {
|
fn write(&mut self, msg: &[u8]) {
|
||||||
@ -243,7 +243,7 @@ impl const super::Hasher for SipHasher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[unstable(feature = "hashmap_internals", issue = "none")]
|
#[unstable(feature = "hashmap_internals", issue = "none")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl const super::Hasher for SipHasher13
|
impl const super::Hasher for SipHasher13
|
||||||
where
|
where
|
||||||
Hasher<Sip13Rounds>: ~const super::Hasher,
|
Hasher<Sip13Rounds>: ~const super::Hasher,
|
||||||
|
@ -3161,7 +3161,7 @@ impl DefaultHasher {
|
|||||||
#[stable(feature = "hashmap_default_hasher", since = "1.13.0")]
|
#[stable(feature = "hashmap_default_hasher", since = "1.13.0")]
|
||||||
#[inline]
|
#[inline]
|
||||||
#[allow(deprecated)]
|
#[allow(deprecated)]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub const fn new() -> DefaultHasher {
|
pub const fn new() -> DefaultHasher {
|
||||||
DefaultHasher(SipHasher13::new_with_keys(0, 0))
|
DefaultHasher(SipHasher13::new_with_keys(0, 0))
|
||||||
@ -3169,7 +3169,7 @@ impl DefaultHasher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "hashmap_default_hasher", since = "1.13.0")]
|
#[stable(feature = "hashmap_default_hasher", since = "1.13.0")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl const Default for DefaultHasher {
|
impl const Default for DefaultHasher {
|
||||||
/// Creates a new `DefaultHasher` using [`new`].
|
/// Creates a new `DefaultHasher` using [`new`].
|
||||||
/// See its documentation for more.
|
/// See its documentation for more.
|
||||||
@ -3182,7 +3182,7 @@ impl const Default for DefaultHasher {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[stable(feature = "hashmap_default_hasher", since = "1.13.0")]
|
#[stable(feature = "hashmap_default_hasher", since = "1.13.0")]
|
||||||
#[rustc_const_unstable(feature = "const_hash", issue = "none")]
|
#[rustc_const_unstable(feature = "const_hash", issue = "104061")]
|
||||||
impl const Hasher for DefaultHasher {
|
impl const Hasher for DefaultHasher {
|
||||||
// The underlying `SipHasher13` doesn't override the other
|
// The underlying `SipHasher13` doesn't override the other
|
||||||
// `write_*` methods, so it's ok not to forward them here.
|
// `write_*` methods, so it's ok not to forward them here.
|
||||||
|
Loading…
Reference in New Issue
Block a user