rollup merge of #19947: csouth3/arc-borrowfrom

Closes #19937.
This commit is contained in:
Alex Crichton 2014-12-17 08:35:53 -08:00
commit 76fbb5d527

View file

@ -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]