Skip to content

Commit

Permalink
Auto merge of #51404 - clarcharr:never_hash, r=KodrAus
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Jun 17, 2018
2 parents 86a8f1a + 570590f commit 4f29363
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/libcore/hash/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit 4f29363

Please sign in to comment.