Skip to content

Commit 4f29363

Browse files
committed
Auto merge of #51404 - clarcharr:never_hash, r=KodrAus
impl Hash for ! This was missing in some generic code I was writing and I figured that it would be worthwhile to add this. Blanket-requiring these traits to allow usage of errors in `HashSet`s and `HashMap`s isn't too unreasonable of a use case, and a prerequisite for allowing `!` as an error in such situations is this impl.
2 parents 86a8f1a + 570590f commit 4f29363

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/libcore/hash/mod.rs

+7
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,13 @@ mod impls {
603603
}
604604
}
605605

606+
#[stable(feature = "never_hash", since = "1.29.0")]
607+
impl Hash for ! {
608+
fn hash<H: Hasher>(&self, _: &mut H) {
609+
*self
610+
}
611+
}
612+
606613
macro_rules! impl_hash_tuple {
607614
() => (
608615
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)