about summary refs log tree commit diff
path: root/src/liballoc
diff options
context:
space:
mode:
authorChase Southwood <chase.southwood@gmail.com>2014-12-16 22:12:40 -0600
committerChase Southwood <chase.southwood@gmail.com>2014-12-16 22:12:40 -0600
commit9caa66f9c8facbe462ce10505c47a98fc2b6f5a0 (patch)
treebfadadab1d3097530ac4b040b513c058672349da /src/liballoc
parent42deaa5e42c0b8a9e305aa5de5d6953b24b77aca (diff)
downloadrust-9caa66f9c8facbe462ce10505c47a98fc2b6f5a0.tar.gz
rust-9caa66f9c8facbe462ce10505c47a98fc2b6f5a0.zip
Implement BorrowFrom<Arc<T>> for T
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 1f1909fd33c..e419d4b0041 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]