From ad7dacd9eb39ae8dba6badb41de03821f9dd7707 Mon Sep 17 00:00:00 2001 From: Aaron Weiss Date: Mon, 8 Dec 2014 15:56:10 -0500 Subject: [PATCH] Implemented BorrowFrom> for T. --- src/liballoc/rc.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 53891583edb20..217c898e661a0 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 Rc { } } +impl BorrowFrom> for T { + fn borrow_from(owned: &Rc) -> &T { + &**owned + } +} + #[experimental = "Deref is experimental."] impl Deref for Rc { #[inline(always)]