Rollup merge of #29176 - huonw:shared-tracking, r=Gankro

This commit is contained in:
Steve Klabnik 2015-10-20 09:43:48 -04:00
commit e058318b2c

View File

@ -538,7 +538,7 @@ impl<T> fmt::Pointer for Unique<T> {
/// building abstractions like `Rc<T>` or `Arc<T>`, which internally /// building abstractions like `Rc<T>` or `Arc<T>`, which internally
/// use raw pointers to manage the memory that they own. /// use raw pointers to manage the memory that they own.
#[unstable(feature = "shared", reason = "needs an RFC to flesh out design", #[unstable(feature = "shared", reason = "needs an RFC to flesh out design",
issue = "0")] issue = "27730")]
pub struct Shared<T: ?Sized> { pub struct Shared<T: ?Sized> {
pointer: NonZero<*const T>, pointer: NonZero<*const T>,
// NOTE: this marker has no consequences for variance, but is necessary // NOTE: this marker has no consequences for variance, but is necessary
@ -551,15 +551,15 @@ pub struct Shared<T: ?Sized> {
/// `Shared` pointers are not `Send` because the data they reference may be aliased. /// `Shared` pointers are not `Send` because the data they reference may be aliased.
// NB: This impl is unnecessary, but should provide better error messages. // NB: This impl is unnecessary, but should provide better error messages.
#[unstable(feature = "shared", issue = "0")] #[unstable(feature = "shared", issue = "27730")]
impl<T: ?Sized> !Send for Shared<T> { } impl<T: ?Sized> !Send for Shared<T> { }
/// `Shared` pointers are not `Sync` because the data they reference may be aliased. /// `Shared` pointers are not `Sync` because the data they reference may be aliased.
// NB: This impl is unnecessary, but should provide better error messages. // NB: This impl is unnecessary, but should provide better error messages.
#[unstable(feature = "shared", issue = "0")] #[unstable(feature = "shared", issue = "27730")]
impl<T: ?Sized> !Sync for Shared<T> { } impl<T: ?Sized> !Sync for Shared<T> { }
#[unstable(feature = "shared", issue = "0")] #[unstable(feature = "shared", issue = "27730")]
impl<T: ?Sized> Shared<T> { impl<T: ?Sized> Shared<T> {
/// Creates a new `Shared`. /// Creates a new `Shared`.
pub unsafe fn new(ptr: *mut T) -> Self { pub unsafe fn new(ptr: *mut T) -> Self {
@ -567,21 +567,21 @@ impl<T: ?Sized> Shared<T> {
} }
} }
#[unstable(feature = "shared", issue = "0")] #[unstable(feature = "shared", issue = "27730")]
impl<T: ?Sized> Clone for Shared<T> { impl<T: ?Sized> Clone for Shared<T> {
fn clone(&self) -> Self { fn clone(&self) -> Self {
*self *self
} }
} }
#[unstable(feature = "shared", issue = "0")] #[unstable(feature = "shared", issue = "27730")]
impl<T: ?Sized> Copy for Shared<T> { } impl<T: ?Sized> Copy for Shared<T> { }
#[cfg(not(stage0))] // remove cfg after new snapshot #[cfg(not(stage0))] // remove cfg after new snapshot
#[unstable(feature = "shared", issue = "0")] #[unstable(feature = "shared", issue = "27730")]
impl<T: ?Sized, U: ?Sized> CoerceUnsized<Shared<U>> for Shared<T> where T: Unsize<U> { } impl<T: ?Sized, U: ?Sized> CoerceUnsized<Shared<U>> for Shared<T> where T: Unsize<U> { }
#[unstable(feature = "shared", issue = "0")] #[unstable(feature = "shared", issue = "27730")]
impl<T: ?Sized> Deref for Shared<T> { impl<T: ?Sized> Deref for Shared<T> {
type Target = *mut T; type Target = *mut T;
@ -591,7 +591,7 @@ impl<T: ?Sized> Deref for Shared<T> {
} }
} }
#[unstable(feature = "shared", issue = "0")] #[unstable(feature = "shared", issue = "27730")]
impl<T> fmt::Pointer for Shared<T> { impl<T> fmt::Pointer for Shared<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
fmt::Pointer::fmt(&*self.pointer, f) fmt::Pointer::fmt(&*self.pointer, f)