diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-08-05 16:40:04 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-08-07 08:54:38 -0700 |
| commit | 1f760d5d1a448c08ff4b66cfa8d35d39a5d667c0 (patch) | |
| tree | 9befa0d5628cafad50e44dbc28e494dbf3b45487 /src/liballoc | |
| parent | b09a02b41588b2348fcce89c37c4a2cdc614d350 (diff) | |
| download | rust-1f760d5d1a448c08ff4b66cfa8d35d39a5d667c0.tar.gz rust-1f760d5d1a448c08ff4b66cfa8d35d39a5d667c0.zip | |
Rename `Share` to `Sync`
This leaves the `Share` trait at `std::kinds` via a `#[deprecated]` `pub use` statement, but the `NoShare` struct is no longer part of `std::kinds::marker` due to #12660 (the build cannot bootstrap otherwise). All code referencing the `Share` trait should now reference the `Sync` trait, and all code referencing the `NoShare` type should now reference the `NoSync` type. The functionality and meaning of this trait have not changed, only the naming. Closes #16281 [breaking-change]
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/arc.rs | 22 | ||||
| -rw-r--r-- | src/liballoc/rc.rs | 14 |
2 files changed, 18 insertions, 18 deletions
diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 3b0ed528060..1d6714430a8 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -15,7 +15,7 @@ use core::atomic; use core::clone::Clone; -use core::kinds::{Share, Send}; +use core::kinds::{Sync, Send}; use core::mem::{min_align_of, size_of, drop}; use core::mem; use core::ops::{Drop, Deref}; @@ -76,7 +76,7 @@ struct ArcInner<T> { data: T, } -impl<T: Share + Send> Arc<T> { +impl<T: Sync + Send> Arc<T> { /// Create an atomically reference counted wrapper. #[inline] #[stable] @@ -95,8 +95,8 @@ impl<T: Share + Send> Arc<T> { 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 `Share` because the inner data is - // `Share` as well, so we're ok loaning out an immutable pointer to + // `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 } } @@ -115,7 +115,7 @@ impl<T: Share + Send> Arc<T> { } #[unstable = "waiting on stability of Clone"] -impl<T: Share + Send> Clone for Arc<T> { +impl<T: Sync + Send> Clone for Arc<T> { /// Duplicate an atomically reference counted wrapper. /// /// The resulting two `Arc` objects will point to the same underlying data @@ -140,14 +140,14 @@ impl<T: Share + Send> Clone for Arc<T> { } #[experimental = "Deref is experimental."] -impl<T: Send + Share> Deref<T> for Arc<T> { +impl<T: Send + Sync> Deref<T> for Arc<T> { #[inline] fn deref(&self) -> &T { &self.inner().data } } -impl<T: Send + Share + Clone> Arc<T> { +impl<T: Send + Sync + Clone> Arc<T> { /// Acquires a mutable pointer to the inner contents by guaranteeing that /// the reference count is one (no sharing is possible). /// @@ -175,7 +175,7 @@ impl<T: Send + Share + Clone> Arc<T> { #[unsafe_destructor] #[experimental = "waiting on stability of Drop"] -impl<T: Share + Send> Drop for Arc<T> { +impl<T: Sync + Send> Drop for Arc<T> { fn drop(&mut self) { // This structure has #[unsafe_no_drop_flag], so this drop glue may run // more than once (but it is guaranteed to be zeroed after the first if @@ -219,7 +219,7 @@ impl<T: Share + Send> Drop for Arc<T> { } #[experimental = "Weak pointers may not belong in this module."] -impl<T: Share + Send> Weak<T> { +impl<T: Sync + Send> Weak<T> { /// Attempts to upgrade this weak reference to a strong reference. /// /// This method will fail to upgrade this reference if the strong reference @@ -245,7 +245,7 @@ impl<T: Share + Send> Weak<T> { } #[experimental = "Weak pointers may not belong in this module."] -impl<T: Share + Send> Clone for Weak<T> { +impl<T: Sync + Send> Clone for Weak<T> { #[inline] fn clone(&self) -> Weak<T> { // See comments in Arc::clone() for why this is relaxed @@ -256,7 +256,7 @@ impl<T: Share + Send> Clone for Weak<T> { #[unsafe_destructor] #[experimental = "Weak pointers may not belong in this module."] -impl<T: Share + Send> Drop for Weak<T> { +impl<T: Sync + Send> Drop for Weak<T> { fn drop(&mut self) { // see comments above for why this check is here if self._ptr.is_null() { return } diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 022928ce743..060f9875bfc 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -179,7 +179,7 @@ pub struct Rc<T> { // field accesses of the contained type via Deref _ptr: *mut RcBox<T>, _nosend: marker::NoSend, - _noshare: marker::NoShare + _noshare: marker::NoSync } #[stable] @@ -199,7 +199,7 @@ impl<T> Rc<T> { weak: Cell::new(1) }), _nosend: marker::NoSend, - _noshare: marker::NoShare + _noshare: marker::NoSync } } } @@ -213,7 +213,7 @@ impl<T> Rc<T> { Weak { _ptr: self._ptr, _nosend: marker::NoSend, - _noshare: marker::NoShare + _noshare: marker::NoSync } } } @@ -348,7 +348,7 @@ impl<T> Clone for Rc<T> { #[inline] fn clone(&self) -> Rc<T> { self.inc_strong(); - Rc { _ptr: self._ptr, _nosend: marker::NoSend, _noshare: marker::NoShare } + Rc { _ptr: self._ptr, _nosend: marker::NoSend, _noshare: marker::NoSync } } } @@ -412,7 +412,7 @@ pub struct Weak<T> { // field accesses of the contained type via Deref _ptr: *mut RcBox<T>, _nosend: marker::NoSend, - _noshare: marker::NoShare + _noshare: marker::NoSync } #[experimental = "Weak pointers may not belong in this module."] @@ -423,7 +423,7 @@ impl<T> Weak<T> { None } else { self.inc_strong(); - Some(Rc { _ptr: self._ptr, _nosend: marker::NoSend, _noshare: marker::NoShare }) + Some(Rc { _ptr: self._ptr, _nosend: marker::NoSend, _noshare: marker::NoSync }) } } } @@ -451,7 +451,7 @@ impl<T> Clone for Weak<T> { #[inline] fn clone(&self) -> Weak<T> { self.inc_weak(); - Weak { _ptr: self._ptr, _nosend: marker::NoSend, _noshare: marker::NoShare } + Weak { _ptr: self._ptr, _nosend: marker::NoSend, _noshare: marker::NoSync } } } |
