diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-12-17 08:35:53 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-12-17 11:50:31 -0800 |
| commit | 76fbb5d527a2893c4d4c88b24d0f5d6dd0dcef32 (patch) | |
| tree | fb366c34d7089ab71f90f99eb26dd646ab2e0332 /src/liballoc | |
| parent | 7ffbd8bad5296560fb1a2c875fa32115d1e59749 (diff) | |
| parent | 9caa66f9c8facbe462ce10505c47a98fc2b6f5a0 (diff) | |
| download | rust-76fbb5d527a2893c4d4c88b24d0f5d6dd0dcef32.tar.gz rust-76fbb5d527a2893c4d4c88b24d0f5d6dd0dcef32.zip | |
rollup merge of #19947: csouth3/arc-borrowfrom
Closes #19937.
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/arc.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 876f335406f..ee4efa2d273 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] |
