|
86 | 86 | #![stable(feature = "rust1", since = "1.0.0")] |
87 | 87 |
|
88 | 88 | use crate::fmt; |
89 | | -use crate::marker; |
| 89 | +use crate::marker::{self, Destruct}; |
90 | 90 |
|
91 | 91 | #[stable(feature = "rust1", since = "1.0.0")] |
92 | 92 | #[allow(deprecated)] |
@@ -648,6 +648,7 @@ impl<H: ~const Hasher + ?Sized> const Hasher for &mut H { |
648 | 648 | /// [`build_hasher`]: BuildHasher::build_hasher |
649 | 649 | /// [`HashMap`]: ../../std/collections/struct.HashMap.html |
650 | 650 | #[stable(since = "1.7.0", feature = "build_hasher")] |
| 651 | +#[const_trait] |
651 | 652 | pub trait BuildHasher { |
652 | 653 | /// Type of the hasher that will be created. |
653 | 654 | #[stable(since = "1.7.0", feature = "build_hasher")] |
@@ -708,9 +709,10 @@ pub trait BuildHasher { |
708 | 709 | /// ); |
709 | 710 | /// ``` |
710 | 711 | #[unstable(feature = "build_hasher_simple_hash_one", issue = "86161")] |
711 | | - fn hash_one<T: Hash>(&self, x: T) -> u64 |
| 712 | + fn hash_one<T: ~const Hash + ~const Destruct>(&self, x: T) -> u64 |
712 | 713 | where |
713 | 714 | Self: Sized, |
| 715 | + Self::Hasher: ~const Hasher + ~const Destruct, |
714 | 716 | { |
715 | 717 | let mut hasher = self.build_hasher(); |
716 | 718 | x.hash(&mut hasher); |
@@ -774,7 +776,8 @@ impl<H> fmt::Debug for BuildHasherDefault<H> { |
774 | 776 | } |
775 | 777 |
|
776 | 778 | #[stable(since = "1.7.0", feature = "build_hasher")] |
777 | | -impl<H: Default + Hasher> BuildHasher for BuildHasherDefault<H> { |
| 779 | +#[rustc_const_unstable(feature = "const_hash", issue = "none")] |
| 780 | +impl<H: ~const Default + Hasher> const BuildHasher for BuildHasherDefault<H> { |
778 | 781 | type Hasher = H; |
779 | 782 |
|
780 | 783 | fn build_hasher(&self) -> H { |
|
0 commit comments