about summary refs log tree commit diff
path: root/src/liballoc/rc.rs
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2014-12-12 18:43:07 -0800
committerSteven Fackler <sfackler@gmail.com>2014-12-15 22:48:54 -0800
commit24a8ef63ff786dd702d428f73fd64aac2a828f19 (patch)
tree6f47ec4857a28ae6b8f01e20742d089edf2dcd1a /src/liballoc/rc.rs
parentb497f050081886803682adc081ddb1e8c4a59a57 (diff)
downloadrust-24a8ef63ff786dd702d428f73fd64aac2a828f19.tar.gz
rust-24a8ef63ff786dd702d428f73fd64aac2a828f19.zip
Move hash module from collections to core
Diffstat (limited to 'src/liballoc/rc.rs')
-rw-r--r--src/liballoc/rc.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs
index 217c898e661..7af816f2e09 100644
--- a/src/liballoc/rc.rs
+++ b/src/liballoc/rc.rs
@@ -147,6 +147,7 @@ use core::clone::Clone;
 use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering};
 use core::default::Default;
 use core::fmt;
+use core::hash::{mod, Hash};
 use core::kinds::marker;
 use core::mem::{transmute, min_align_of, size_of, forget};
 use core::ops::{Deref, Drop};
@@ -594,6 +595,14 @@ impl<T: Ord> Ord for Rc<T> {
     fn cmp(&self, other: &Rc<T>) -> Ordering { (**self).cmp(&**other) }
 }
 
+// FIXME (#18248) Make `T` `Sized?`
+impl<S: hash::Writer, T: Hash<S>> Hash<S> for Rc<T> {
+    #[inline]
+    fn hash(&self, state: &mut S) {
+        (**self).hash(state);
+    }
+}
+
 #[experimental = "Show is experimental."]
 impl<T: fmt::Show> fmt::Show for Rc<T> {
     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {