From 4582c14bd48c74521e549fafc1e4a7d30e2b7b85 Mon Sep 17 00:00:00 2001 From: Konrad Borowski Date: Sun, 22 Mar 2020 20:02:29 +0100 Subject: [PATCH] Implement Hash for Infallible --- src/libcore/convert/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libcore/convert/mod.rs b/src/libcore/convert/mod.rs index 47ab8715cfa14..eef9ee7cb0093 100644 --- a/src/libcore/convert/mod.rs +++ b/src/libcore/convert/mod.rs @@ -41,6 +41,7 @@ #![stable(feature = "rust1", since = "1.0.0")] use crate::fmt; +use crate::hash::{Hash, Hasher}; mod num; @@ -746,3 +747,10 @@ impl From for Infallible { x } } + +#[stable(feature = "convert_infallible_hash", since = "1.44.0")] +impl Hash for Infallible { + fn hash(&self, _: &mut H) { + match *self {} + } +}