diff options
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/rc.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 53891583edb..217c898e661 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -141,6 +141,7 @@ #![stable] +use core::borrow::BorrowFrom; use core::cell::Cell; use core::clone::Clone; use core::cmp::{PartialEq, PartialOrd, Eq, Ord, Ordering}; @@ -349,6 +350,12 @@ impl<T: Clone> Rc<T> { } } +impl<T> BorrowFrom<Rc<T>> for T { + fn borrow_from(owned: &Rc<T>) -> &T { + &**owned + } +} + #[experimental = "Deref is experimental."] impl<T> Deref<T> for Rc<T> { #[inline(always)] |
