about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-12-17 08:35:53 -0800
committerAlex Crichton <alex@alexcrichton.com>2014-12-17 11:50:31 -0800
commit76fbb5d527a2893c4d4c88b24d0f5d6dd0dcef32 (patch)
treefb366c34d7089ab71f90f99eb26dd646ab2e0332 /src/liballoc
parent7ffbd8bad5296560fb1a2c875fa32115d1e59749 (diff)
parent9caa66f9c8facbe462ce10505c47a98fc2b6f5a0 (diff)
downloadrust-76fbb5d527a2893c4d4c88b24d0f5d6dd0dcef32.tar.gz
rust-76fbb5d527a2893c4d4c88b24d0f5d6dd0dcef32.zip
rollup merge of #19947: csouth3/arc-borrowfrom
Closes #19937.
Diffstat (limited to 'src/liballoc')
-rw-r--r--src/liballoc/arc.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs
index 876f335406f..ee4efa2d273 100644
--- a/src/liballoc/arc.rs
+++ b/src/liballoc/arc.rs
@@ -14,6 +14,7 @@
 //! between tasks.
 
 use core::atomic;
+use core::borrow::BorrowFrom;
 use core::clone::Clone;
 use core::fmt::{mod, Show};
 use core::cmp::{Eq, Ord, PartialEq, PartialOrd, Ordering};
@@ -155,6 +156,12 @@ impl<T> Clone for Arc<T> {
     }
 }
 
+impl<T> BorrowFrom<Arc<T>> for T {
+    fn borrow_from(owned: &Arc<T>) -> &T {
+        &**owned
+    }
+}
+
 #[experimental = "Deref is experimental."]
 impl<T> Deref<T> for Arc<T> {
     #[inline]