From 9caa66f9c8facbe462ce10505c47a98fc2b6f5a0 Mon Sep 17 00:00:00 2001 From: Chase Southwood Date: Tue, 16 Dec 2014 22:12:40 -0600 Subject: [PATCH] Implement BorrowFrom> for T --- src/liballoc/arc.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 1f1909fd33cc1..e419d4b0041dc 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 Clone for Arc { } } +impl BorrowFrom> for T { + fn borrow_from(owned: &Arc) -> &T { + &**owned + } +} + #[experimental = "Deref is experimental."] impl Deref for Arc { #[inline]