about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-06-17 22:25:34 +0000
committerbors <bors@rust-lang.org>2018-06-17 22:25:34 +0000
commit4f2936393e27d0cef2fc2ecddea2f5b0cee2b36a (patch)
treea53e353e857c942129af318d1c9cc1dc5b2a16a4 /src
parent86a8f1a6374dd558ebdafe061e61720a73ae732c (diff)
parent570590f7271ddd1bcedf14a7bbc38975db720419 (diff)
downloadrust-4f2936393e27d0cef2fc2ecddea2f5b0cee2b36a.tar.gz
rust-4f2936393e27d0cef2fc2ecddea2f5b0cee2b36a.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/libcore/hash/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/libcore/hash/mod.rs b/src/libcore/hash/mod.rs
index 3e1f21cafe4..e6f8dfffd63 100644
--- a/src/libcore/hash/mod.rs
+++ b/src/libcore/hash/mod.rs
@@ -603,6 +603,13 @@ mod impls {
         }
     }
 
+    #[stable(feature = "never_hash", since = "1.29.0")]
+    impl Hash for ! {
+        fn hash<H: Hasher>(&self, _: &mut H) {
+            *self
+        }
+    }
+
     macro_rules! impl_hash_tuple {
         () => (
             #[stable(feature = "rust1", since = "1.0.0")]