about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-12-09 19:12:02 +0000
committerbors <bors@rust-lang.org>2014-12-09 19:12:02 +0000
commitb25e100173effba685d076cee16f8af150078617 (patch)
tree6c045a3ce5fe575f6e4e4663d4e748780e7416cd /src/liballoc
parentef4982f0f8643af9e7deede95ad5e4e8df854d66 (diff)
parent1a61fe4280b476bb2131f76414c32676b91e163c (diff)
downloadrust-b25e100173effba685d076cee16f8af150078617.tar.gz
rust-b25e100173effba685d076cee16f8af150078617.zip
auto merge of #19665 : alexcrichton/rust/rollup, r=alexcrichton
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/rc.rs7
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)]