diff options
Diffstat (limited to 'src/liballoc/rc.rs')
| -rw-r--r-- | src/liballoc/rc.rs | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index f361c36ec8f..9d395115431 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -144,13 +144,12 @@ #![stable(feature = "rust1", since = "1.0.0")] -use core::borrow::BorrowFrom; use core::cell::Cell; use core::clone::Clone; use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering}; use core::default::Default; use core::fmt; -use core::hash::{self, Hash}; +use core::hash::{Hasher, Hash}; use core::marker; use core::mem::{transmute, min_align_of, size_of, forget}; use core::nonzero::NonZero; @@ -349,12 +348,6 @@ impl<T: Clone> Rc<T> { } } -impl<T> BorrowFrom<Rc<T>> for T { - fn borrow_from(owned: &Rc<T>) -> &T { - &**owned - } -} - #[stable(feature = "rust1", since = "1.0.0")] impl<T> Deref for Rc<T> { type Target = T; @@ -599,12 +592,20 @@ impl<T: Ord> Ord for Rc<T> { } // FIXME (#18248) Make `T` `Sized?` -impl<S: hash::Hasher, T: Hash<S>> Hash<S> for Rc<T> { +#[cfg(stage0)] +impl<S: Hasher, T: Hash<S>> Hash<S> for Rc<T> { #[inline] fn hash(&self, state: &mut S) { (**self).hash(state); } } +#[cfg(not(stage0))] +#[stable(feature = "rust1", since = "1.0.0")] +impl<T: Hash> Hash for Rc<T> { + fn hash<H: Hasher>(&self, state: &mut H) { + (**self).hash(state); + } +} #[stable(feature = "rust1", since = "1.0.0")] impl<T: fmt::Display> fmt::Display for Rc<T> { |
