diff options
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/arc.rs | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 88a3752c88a..c95b413b397 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -201,10 +201,11 @@ impl<T> Arc<T> { impl<T> Arc<T> { #[inline] fn inner(&self) -> &ArcInner<T> { - // This unsafety is ok because while this arc is alive we're guaranteed that the inner - // pointer is valid. Furthermore, we know that the `ArcInner` structure itself is `Sync` - // because the inner data is `Sync` as well, so we're ok loaning out an immutable pointer - // to these contents. + // This unsafety is ok because while this arc is alive we're guaranteed + // that the inner pointer is valid. Furthermore, we know that the + // `ArcInner` structure itself is `Sync` because the inner data is + // `Sync` as well, so we're ok loaning out an immutable pointer to these + // contents. unsafe { &**self._ptr } } } @@ -236,13 +237,15 @@ impl<T> Clone for Arc<T> { /// ``` #[inline] fn clone(&self) -> Arc<T> { - // Using a relaxed ordering is alright here, as knowledge of the original reference - // prevents other threads from erroneously deleting the object. + // Using a relaxed ordering is alright here, as knowledge of the + // original reference prevents other threads from erroneously deleting + // the object. // - // As explained in the [Boost documentation][1], Increasing the reference counter can - // always be done with memory_order_relaxed: New references to an object can only be formed - // from an existing reference, and passing an existing reference from one thread to another - // must already provide any required synchronization. + // As explained in the [Boost documentation][1], Increasing the + // reference counter can always be done with memory_order_relaxed: New + // references to an object can only be formed from an existing + // reference, and passing an existing reference from one thread to + // another must already provide any required synchronization. // // [1]: (www.boost.org/doc/libs/1_55_0/doc/html/atomic/usage_examples.html) self.inner().strong.fetch_add(1, Relaxed); |
