Skip to content

Commit 76fbb5d

Browse files
committed
rollup merge of #19947: csouth3/arc-borrowfrom
Closes #19937.
2 parents 7ffbd8b + 9caa66f commit 76fbb5d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/liballoc/arc.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
//! between tasks.
1515
1616
use core::atomic;
17+
use core::borrow::BorrowFrom;
1718
use core::clone::Clone;
1819
use core::fmt::{mod, Show};
1920
use core::cmp::{Eq, Ord, PartialEq, PartialOrd, Ordering};
@@ -155,6 +156,12 @@ impl<T> Clone for Arc<T> {
155156
}
156157
}
157158

159+
impl<T> BorrowFrom<Arc<T>> for T {
160+
fn borrow_from(owned: &Arc<T>) -> &T {
161+
&**owned
162+
}
163+
}
164+
158165
#[experimental = "Deref is experimental."]
159166
impl<T> Deref<T> for Arc<T> {
160167
#[inline]

0 commit comments

Comments
 (0)