Skip to content

Commit

Permalink
Unrolled build for rust-lang#123198
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#123198 - krtab:build_hasher_default_const_new, r=Amanieu

Add fn const BuildHasherDefault::new

See [tracking issue](rust-lang#123197) for justification.
  • Loading branch information
rust-timer committed Apr 2, 2024
2 parents a77322c + 54ab425 commit 48d7e18
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion library/core/src/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,18 @@ pub trait BuildHasher {
#[stable(since = "1.7.0", feature = "build_hasher")]
pub struct BuildHasherDefault<H>(marker::PhantomData<fn() -> H>);

impl<H> BuildHasherDefault<H> {
/// Creates a new BuildHasherDefault for Hasher `H`.
#[unstable(
feature = "build_hasher_default_const_new",
issue = "123197",
reason = "recently added"
)]
pub const fn new() -> Self {
BuildHasherDefault(marker::PhantomData)
}
}

#[stable(since = "1.9.0", feature = "core_impl_debug")]
impl<H> fmt::Debug for BuildHasherDefault<H> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand All @@ -778,7 +790,7 @@ impl<H> Clone for BuildHasherDefault<H> {
#[stable(since = "1.7.0", feature = "build_hasher")]
impl<H> Default for BuildHasherDefault<H> {
fn default() -> BuildHasherDefault<H> {
BuildHasherDefault(marker::PhantomData)
Self::new()
}
}

Expand Down

0 comments on commit 48d7e18

Please sign in to comment.