From 7e2ffc7090a70fe8c77a0e03fcec3cb1387141f2 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Mon, 16 Nov 2015 19:54:28 +0300 Subject: Add missing annotations and some tests --- src/liballoc/arc.rs | 7 +++++++ src/liballoc/boxed.rs | 22 ++++++++++++++++++++++ src/liballoc/rc.rs | 7 +++++++ 3 files changed, 36 insertions(+) (limited to 'src/liballoc') diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 8205e13205f..7863f101811 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -130,10 +130,13 @@ pub struct Arc { _ptr: Shared>, } +#[stable(feature = "rust1", since = "1.0.0")] unsafe impl Send for Arc { } +#[stable(feature = "rust1", since = "1.0.0")] unsafe impl Sync for Arc { } #[cfg(not(stage0))] // remove cfg after new snapshot +#[unstable(feature = "coerce_unsized", issue = "27732")] impl, U: ?Sized> CoerceUnsized> for Arc {} /// A weak pointer to an `Arc`. @@ -148,10 +151,13 @@ pub struct Weak { _ptr: Shared>, } +#[stable(feature = "rust1", since = "1.0.0")] unsafe impl Send for Weak { } +#[stable(feature = "rust1", since = "1.0.0")] unsafe impl Sync for Weak { } #[cfg(not(stage0))] // remove cfg after new snapshot +#[unstable(feature = "coerce_unsized", issue = "27732")] impl, U: ?Sized> CoerceUnsized> for Weak {} #[stable(feature = "rust1", since = "1.0.0")] @@ -1157,6 +1163,7 @@ mod tests { } } +#[stable(feature = "rust1", since = "1.0.0")] impl borrow::Borrow for Arc { fn borrow(&self) -> &T { &**self diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index b5c6cdff119..65c66ebe768 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -136,6 +136,9 @@ pub struct IntermediateBox { marker: marker::PhantomData<*mut T>, } +#[unstable(feature = "placement_in", + reason = "placement box design is still being worked out.", + issue = "27779")] impl Place for IntermediateBox { fn pointer(&mut self) -> *mut T { self.ptr as *mut T @@ -170,12 +173,18 @@ fn make_place() -> IntermediateBox { } } +#[unstable(feature = "placement_in", + reason = "placement box design is still being worked out.", + issue = "27779")] impl BoxPlace for IntermediateBox { fn make_place() -> IntermediateBox { make_place() } } +#[unstable(feature = "placement_in", + reason = "placement box design is still being worked out.", + issue = "27779")] impl InPlace for IntermediateBox { type Owner = Box; unsafe fn finalize(self) -> Box { @@ -183,6 +192,7 @@ impl InPlace for IntermediateBox { } } +#[unstable(feature = "placement_new_protocol", issue = "27779")] impl Boxed for Box { type Data = T; type Place = IntermediateBox; @@ -191,6 +201,9 @@ impl Boxed for Box { } } +#[unstable(feature = "placement_in", + reason = "placement box design is still being worked out.", + issue = "27779")] impl Placer for ExchangeHeapSingleton { type Place = IntermediateBox; @@ -199,6 +212,9 @@ impl Placer for ExchangeHeapSingleton { } } +#[unstable(feature = "placement_in", + reason = "placement box design is still being worked out.", + issue = "27779")] impl Drop for IntermediateBox { fn drop(&mut self) { if self.size > 0 { @@ -518,6 +534,7 @@ pub trait FnBox { fn call_box(self: Box, args: A) -> Self::Output; } +#[unstable(feature = "fnbox", reason = "Newly introduced", issue = "0")] impl FnBox for F where F: FnOnce { @@ -528,6 +545,7 @@ impl FnBox for F } } +#[unstable(feature = "fnbox", reason = "Newly introduced", issue = "0")] impl<'a,A,R> FnOnce for Box+'a> { type Output = R; @@ -536,6 +554,7 @@ impl<'a,A,R> FnOnce for Box+'a> { } } +#[unstable(feature = "fnbox", reason = "Newly introduced", issue = "0")] impl<'a,A,R> FnOnce for Box+Send+'a> { type Output = R; @@ -544,6 +563,7 @@ impl<'a,A,R> FnOnce for Box+Send+'a> { } } +#[unstable(feature = "coerce_unsized", issue = "27732")] impl, U: ?Sized> CoerceUnsized> for Box {} #[stable(feature = "box_slice_clone", since = "1.3.0")] @@ -597,12 +617,14 @@ impl Clone for Box<[T]> { } } +#[stable(feature = "rust1", since = "1.0.0")] impl borrow::Borrow for Box { fn borrow(&self) -> &T { &**self } } +#[stable(feature = "rust1", since = "1.0.0")] impl borrow::BorrowMut for Box { fn borrow_mut(&mut self) -> &mut T { &mut **self diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 88db3cfe4b6..7abdc447ee5 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -191,10 +191,13 @@ pub struct Rc { _ptr: Shared>, } +#[stable(feature = "rust1", since = "1.0.0")] impl !marker::Send for Rc {} +#[stable(feature = "rust1", since = "1.0.0")] impl !marker::Sync for Rc {} #[cfg(not(stage0))] // remove cfg after new snapshot +#[unstable(feature = "coerce_unsized", issue = "27732")] impl, U: ?Sized> CoerceUnsized> for Rc {} impl Rc { @@ -723,10 +726,13 @@ pub struct Weak { _ptr: Shared>, } +#[stable(feature = "rust1", since = "1.0.0")] impl !marker::Send for Weak {} +#[stable(feature = "rust1", since = "1.0.0")] impl !marker::Sync for Weak {} #[cfg(not(stage0))] // remove cfg after new snapshot +#[unstable(feature = "coerce_unsized", issue = "27732")] impl, U: ?Sized> CoerceUnsized> for Weak {} impl Weak { @@ -1126,6 +1132,7 @@ mod tests { } } +#[stable(feature = "rust1", since = "1.0.0")] impl borrow::Borrow for Rc { fn borrow(&self) -> &T { &**self -- cgit 1.4.1-3-g733a5