Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework stability annotation pass #29083

Merged
merged 4 commits into from
Nov 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,13 @@ pub struct Arc<T: ?Sized> {
_ptr: Shared<ArcInner<T>>,
}

#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T: ?Sized + Sync + Send> Send for Arc<T> { }
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T: ?Sized + Sync + Send> Sync for Arc<T> { }

#[cfg(not(stage0))] // remove cfg after new snapshot
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Arc<U>> for Arc<T> {}

/// A weak pointer to an `Arc`.
Expand All @@ -148,10 +151,13 @@ pub struct Weak<T: ?Sized> {
_ptr: Shared<ArcInner<T>>,
}

#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T: ?Sized + Sync + Send> Send for Weak<T> { }
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T: ?Sized + Sync + Send> Sync for Weak<T> { }

#[cfg(not(stage0))] // remove cfg after new snapshot
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Weak<U>> for Weak<T> {}

#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -1157,6 +1163,7 @@ mod tests {
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> borrow::Borrow<T> for Arc<T> {
fn borrow(&self) -> &T {
&**self
Expand Down
22 changes: 22 additions & 0 deletions src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ pub struct IntermediateBox<T: ?Sized> {
marker: marker::PhantomData<*mut T>,
}

#[unstable(feature = "placement_in",
reason = "placement box design is still being worked out.",
issue = "27779")]
impl<T> Place<T> for IntermediateBox<T> {
fn pointer(&mut self) -> *mut T {
self.ptr as *mut T
Expand Down Expand Up @@ -170,19 +173,26 @@ fn make_place<T>() -> IntermediateBox<T> {
}
}

#[unstable(feature = "placement_in",
reason = "placement box design is still being worked out.",
issue = "27779")]
impl<T> BoxPlace<T> for IntermediateBox<T> {
fn make_place() -> IntermediateBox<T> {
make_place()
}
}

#[unstable(feature = "placement_in",
reason = "placement box design is still being worked out.",
issue = "27779")]
impl<T> InPlace<T> for IntermediateBox<T> {
type Owner = Box<T>;
unsafe fn finalize(self) -> Box<T> {
finalize(self)
}
}

#[unstable(feature = "placement_new_protocol", issue = "27779")]
impl<T> Boxed for Box<T> {
type Data = T;
type Place = IntermediateBox<T>;
Expand All @@ -191,6 +201,9 @@ impl<T> Boxed for Box<T> {
}
}

#[unstable(feature = "placement_in",
reason = "placement box design is still being worked out.",
issue = "27779")]
impl<T> Placer<T> for ExchangeHeapSingleton {
type Place = IntermediateBox<T>;

Expand All @@ -199,6 +212,9 @@ impl<T> Placer<T> for ExchangeHeapSingleton {
}
}

#[unstable(feature = "placement_in",
reason = "placement box design is still being worked out.",
issue = "27779")]
impl<T: ?Sized> Drop for IntermediateBox<T> {
fn drop(&mut self) {
if self.size > 0 {
Expand Down Expand Up @@ -518,6 +534,7 @@ pub trait FnBox<A> {
fn call_box(self: Box<Self>, args: A) -> Self::Output;
}

#[unstable(feature = "fnbox", reason = "Newly introduced", issue = "0")]
impl<A,F> FnBox<A> for F
where F: FnOnce<A>
{
Expand All @@ -528,6 +545,7 @@ impl<A,F> FnBox<A> for F
}
}

#[unstable(feature = "fnbox", reason = "Newly introduced", issue = "0")]
impl<'a,A,R> FnOnce<A> for Box<FnBox<A,Output=R>+'a> {
type Output = R;

Expand All @@ -536,6 +554,7 @@ impl<'a,A,R> FnOnce<A> for Box<FnBox<A,Output=R>+'a> {
}
}

#[unstable(feature = "fnbox", reason = "Newly introduced", issue = "0")]
impl<'a,A,R> FnOnce<A> for Box<FnBox<A,Output=R>+Send+'a> {
type Output = R;

Expand All @@ -544,6 +563,7 @@ impl<'a,A,R> FnOnce<A> for Box<FnBox<A,Output=R>+Send+'a> {
}
}

#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}

#[stable(feature = "box_slice_clone", since = "1.3.0")]
Expand Down Expand Up @@ -597,12 +617,14 @@ impl<T: Clone> Clone for Box<[T]> {
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> borrow::Borrow<T> for Box<T> {
fn borrow(&self) -> &T {
&**self
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> borrow::BorrowMut<T> for Box<T> {
fn borrow_mut(&mut self) -> &mut T {
&mut **self
Expand Down
7 changes: 7 additions & 0 deletions src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,13 @@ pub struct Rc<T: ?Sized> {
_ptr: Shared<RcBox<T>>,
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> !marker::Send for Rc<T> {}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> !marker::Sync for Rc<T> {}

#[cfg(not(stage0))] // remove cfg after new snapshot
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<Rc<U>> for Rc<T> {}

impl<T> Rc<T> {
Expand Down Expand Up @@ -723,10 +726,13 @@ pub struct Weak<T: ?Sized> {
_ptr: Shared<RcBox<T>>,
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> !marker::Send for Weak<T> {}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> !marker::Sync for Weak<T> {}

#[cfg(not(stage0))] // remove cfg after new snapshot
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<Weak<U>> for Weak<T> {}

impl<T: ?Sized> Weak<T> {
Expand Down Expand Up @@ -1126,6 +1132,7 @@ mod tests {
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> borrow::Borrow<T> for Rc<T> {
fn borrow(&self) -> &T {
&**self
Expand Down
2 changes: 2 additions & 0 deletions src/libcollections/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,7 @@ impl<'a, T: 'a> DoubleEndedIterator for Drain<'a, T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T: 'a> ExactSizeIterator for Drain<'a, T> {}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Ord> From<Vec<T>> for BinaryHeap<T> {
fn from(vec: Vec<T>) -> BinaryHeap<T> {
let mut heap = BinaryHeap { data: vec };
Expand All @@ -743,6 +744,7 @@ impl<T: Ord> From<Vec<T>> for BinaryHeap<T> {
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<T> From<BinaryHeap<T>> for Vec<T> {
fn from(heap: BinaryHeap<T>) -> Vec<T> {
heap.data
Expand Down
1 change: 1 addition & 0 deletions src/libcollections/borrow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use fmt;

use self::Cow::*;

#[stable(feature = "rust1", since = "1.0.0")]
pub use core::borrow::{Borrow, BorrowMut};

#[stable(feature = "rust1", since = "1.0.0")]
Expand Down
1 change: 0 additions & 1 deletion src/libcollections/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ impl<K, V> Node<K, V> {
}

// FIXME(gereeter) Write an efficient clone_from
#[stable(feature = "rust1", since = "1.0.0")]
impl<K: Clone, V: Clone> Clone for Node<K, V> {
fn clone(&self) -> Node<K, V> {
let mut ret = if self.is_leaf() {
Expand Down
12 changes: 11 additions & 1 deletion src/libcollections/fmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,13 +475,23 @@

#![stable(feature = "rust1", since = "1.0.0")]

pub use core::fmt::{Formatter, Result, Write, rt};
#[unstable(feature = "fmt_internals", issue = "0")]
pub use core::fmt::rt;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{Formatter, Result, Write};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{Octal, Binary};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{Display, Debug};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{LowerHex, UpperHex, Pointer};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{LowerExp, UpperExp};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::Error;
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{ArgumentV1, Arguments, write, radix, Radix, RadixFmt};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::fmt::{DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple};

use string;
Expand Down
2 changes: 2 additions & 0 deletions src/libcollections/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,13 @@ pub mod vec_deque;

#[stable(feature = "rust1", since = "1.0.0")]
pub mod btree_map {
#[stable(feature = "rust1", since = "1.0.0")]
pub use btree::map::*;
}

#[stable(feature = "rust1", since = "1.0.0")]
pub mod btree_set {
#[stable(feature = "rust1", since = "1.0.0")]
pub use btree::set::*;
}

Expand Down
2 changes: 2 additions & 0 deletions src/libcollections/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -857,6 +857,7 @@ impl<A> DoubleEndedIterator for IntoIter<A> {
fn next_back(&mut self) -> Option<A> { self.list.pop_back() }
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<A> ExactSizeIterator for IntoIter<A> {}

#[stable(feature = "rust1", since = "1.0.0")]
Expand Down Expand Up @@ -890,6 +891,7 @@ impl<'a, T> IntoIterator for &'a LinkedList<T> {
}
}

#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> IntoIterator for &'a mut LinkedList<T> {
type Item = &'a mut T;
type IntoIter = IterMut<'a, T>;
Expand Down
9 changes: 9 additions & 0 deletions src/libcollections/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,18 @@ use core::slice as core_slice;
use borrow::{Borrow, BorrowMut, ToOwned};
use vec::Vec;

#[stable(feature = "rust1", since = "1.0.0")]
pub use core::slice::{Chunks, Windows};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::slice::{Iter, IterMut};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::slice::{SplitMut, ChunksMut, Split};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::slice::{SplitN, RSplitN, SplitNMut, RSplitNMut};
#[unstable(feature = "ref_slice", issue = "27774")]
#[allow(deprecated)]
pub use core::slice::{bytes, mut_ref_slice, ref_slice};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::slice::{from_raw_parts, from_raw_parts_mut};

////////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -860,6 +866,9 @@ pub trait SliceConcatExt<T: ?Sized> {
fn connect(&self, sep: &T) -> Self::Output;
}

#[unstable(feature = "slice_concat_ext",
reason = "trait should not have to exist",
issue = "27747")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a bit of an interesting declaration because it's basically stable right now that slices have these methods, it's just unstable to import them or use UFCS via the trait. Not entirely sure what that means about the stability of the impl block itself, but it's fine either way

impl<T: Clone, V: Borrow<[T]>> SliceConcatExt<T> for [V] {
type Output = Vec<T>;

Expand Down
14 changes: 14 additions & 0 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,33 @@ use vec::Vec;
use slice::SliceConcatExt;
use boxed::Box;

#[stable(feature = "rust1", since = "1.0.0")]
pub use core::str::{FromStr, Utf8Error};
#[allow(deprecated)]
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::str::{Lines, LinesAny, CharRange};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::str::{Split, RSplit};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::str::{SplitN, RSplitN};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::str::{SplitTerminator, RSplitTerminator};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::str::{Matches, RMatches};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::str::{MatchIndices, RMatchIndices};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::str::{from_utf8, Chars, CharIndices, Bytes};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::str::{from_utf8_unchecked, ParseBoolError};
#[stable(feature = "rust1", since = "1.0.0")]
pub use rustc_unicode::str::{SplitWhitespace};
#[stable(feature = "rust1", since = "1.0.0")]
pub use core::str::pattern;

#[unstable(feature = "slice_concat_ext",
reason = "trait should not have to exist",
issue = "27747")]
impl<S: Borrow<str>> SliceConcatExt<str> for [S] {
type Output = String;

Expand Down
9 changes: 9 additions & 0 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,9 @@ impl Extend<String> for String {
}

/// A convenience impl that delegates to the impl for `&str`
#[unstable(feature = "pattern",
reason = "API not fully fleshed out and ready to be stabilized",
issue = "27721")]
impl<'a, 'b> Pattern<'a> for &'b String {
type Searcher = <&'b str as Pattern<'a>>::Searcher;

Expand Down Expand Up @@ -1143,24 +1146,28 @@ impl FromStr for String {
}
}

#[stable(feature = "str_parse_error", since = "1.5.0")]
impl Clone for ParseError {
fn clone(&self) -> ParseError {
match *self {}
}
}

#[stable(feature = "str_parse_error", since = "1.5.0")]
impl fmt::Debug for ParseError {
fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
match *self {}
}
}

#[stable(feature = "str_parse_error", since = "1.5.0")]
impl PartialEq for ParseError {
fn eq(&self, _: &ParseError) -> bool {
match *self {}
}
}

#[stable(feature = "str_parse_error", since = "1.5.0")]
impl Eq for ParseError {}

/// A generic trait for converting a value to a string
Expand Down Expand Up @@ -1287,7 +1294,9 @@ pub struct Drain<'a> {
iter: Chars<'a>,
}

#[unstable(feature = "drain", reason = "recently added", issue = "27711")]
unsafe impl<'a> Sync for Drain<'a> {}
#[unstable(feature = "drain", reason = "recently added", issue = "27711")]
unsafe impl<'a> Send for Drain<'a> {}

#[unstable(feature = "drain", reason = "recently added", issue = "27711")]
Expand Down
Loading