Auto merge of #29083 - petrochenkov:stability3, r=alexcrichton

What this patch does:
- Stability annotations are now based on "exported items" supplied by rustc_privacy and not "public items". Exported items are as accessible for external crates as directly public items and should be annotated with stability attributes.
- Trait impls require annotations now.
- Reexports require annotations now.
- Crates themselves didn't require annotations, now they do.
- Exported macros are annotated now, but these annotations are not used yet.
- Some useless annotations are detected and result in errors
- Finally, some small bugs are fixed - deprecation propagates from stable deprecated parents, items in blocks are traversed correctly (fixes https://github.com/rust-lang/rust/issues/29034) + some code cleanup.
This commit is contained in:
bors
2015-11-18 19:49:33 +00:00
102 changed files with 635 additions and 170 deletions

View File

@@ -97,6 +97,7 @@ pub trait Any: Reflect + 'static {
fn get_type_id(&self) -> TypeId;
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: Reflect + 'static> Any for T {
fn get_type_id(&self) -> TypeId { TypeId::of::<T>() }
}

View File

@@ -791,6 +791,7 @@ pub struct UnsafeCell<T: ?Sized> {
value: T,
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T: ?Sized> !Sync for UnsafeCell<T> {}
impl<T> UnsafeCell<T> {

View File

@@ -152,6 +152,9 @@ pub trait CharExt {
fn encode_utf16(self, dst: &mut [u16]) -> Option<usize>;
}
#[unstable(feature = "core_char_ext",
reason = "the stable interface is `impl char` in later crate",
issue = "27701")]
impl CharExt for char {
#[inline]
fn is_digit(self, radix: u32) -> bool {

View File

@@ -24,10 +24,13 @@ use slice;
use str;
use self::rt::v1::Alignment;
#[unstable(feature = "fmt_radix", issue = "27728")]
pub use self::num::radix;
#[unstable(feature = "fmt_radix", issue = "27728")]
pub use self::num::Radix;
#[unstable(feature = "fmt_radix", issue = "27728")]
pub use self::num::RadixFmt;
#[stable(feature = "debug_builders", since = "1.2.0")]
pub use self::builders::{DebugStruct, DebugTuple, DebugSet, DebugList, DebugMap};
mod num;
@@ -170,6 +173,8 @@ pub struct ArgumentV1<'a> {
formatter: fn(&Void, &mut Formatter) -> Result,
}
#[unstable(feature = "fmt_internals", reason = "internal to format_args!",
issue = "0")]
impl<'a> Clone for ArgumentV1<'a> {
fn clone(&self) -> ArgumentV1<'a> {
*self
@@ -1568,6 +1573,7 @@ impl Debug for () {
f.pad("()")
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Debug for PhantomData<T> {
fn fmt(&self, f: &mut Formatter) -> Result {
f.pad("PhantomData")

View File

@@ -264,6 +264,7 @@ const DEC_DIGITS_LUT: &'static[u8] =
macro_rules! impl_Display {
($($t:ident),*: $conv_fn:ident) => ($(
#[stable(feature = "rust1", since = "1.0.0")]
impl fmt::Display for $t {
#[allow(unused_comparisons)]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

View File

@@ -75,6 +75,7 @@ use prelude::v1::*;
use mem;
#[stable(feature = "rust1", since = "1.0.0")]
pub use self::sip::SipHasher;
mod sip;

View File

@@ -3604,6 +3604,7 @@ impl<I: Iterator> Peekable<I> {
///
/// assert_eq!(iter.is_empty(), true);
/// ```
#[unstable(feature = "core", issue = "27701")]
#[inline]
pub fn is_empty(&mut self) -> bool {
self.peek().is_none()
@@ -4107,6 +4108,9 @@ pub trait Step: PartialOrd + Sized {
macro_rules! step_impl_unsigned {
($($t:ty)*) => ($(
#[unstable(feature = "step_trait",
reason = "likely to be replaced by finer-grained traits",
issue = "27741")]
impl Step for $t {
#[inline]
fn step(&self, by: &$t) -> Option<$t> {
@@ -4134,6 +4138,9 @@ macro_rules! step_impl_unsigned {
}
macro_rules! step_impl_signed {
($($t:ty)*) => ($(
#[unstable(feature = "step_trait",
reason = "likely to be replaced by finer-grained traits",
issue = "27741")]
impl Step for $t {
#[inline]
fn step(&self, by: &$t) -> Option<$t> {
@@ -4173,6 +4180,9 @@ macro_rules! step_impl_signed {
macro_rules! step_impl_no_between {
($($t:ty)*) => ($(
#[unstable(feature = "step_trait",
reason = "likely to be replaced by finer-grained traits",
issue = "27741")]
impl Step for $t {
#[inline]
fn step(&self, by: &$t) -> Option<$t> {

View File

@@ -31,9 +31,12 @@ pub unsafe trait Send {
// empty.
}
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl Send for .. { }
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> !Send for *const T { }
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> !Send for *mut T { }
/// Types with a constant size known at compile-time.
@@ -223,48 +226,59 @@ pub unsafe trait Sync {
// Empty
}
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl Sync for .. { }
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> !Sync for *const T { }
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> !Sync for *mut T { }
macro_rules! impls{
($t: ident) => (
#[stable(feature = "rust1", since = "1.0.0")]
impl<T:?Sized> Hash for $t<T> {
#[inline]
fn hash<H: Hasher>(&self, _: &mut H) {
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T:?Sized> cmp::PartialEq for $t<T> {
fn eq(&self, _other: &$t<T>) -> bool {
true
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T:?Sized> cmp::Eq for $t<T> {
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T:?Sized> cmp::PartialOrd for $t<T> {
fn partial_cmp(&self, _other: &$t<T>) -> Option<cmp::Ordering> {
Option::Some(cmp::Ordering::Equal)
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T:?Sized> cmp::Ord for $t<T> {
fn cmp(&self, _other: &$t<T>) -> cmp::Ordering {
cmp::Ordering::Equal
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T:?Sized> Copy for $t<T> { }
#[stable(feature = "rust1", since = "1.0.0")]
impl<T:?Sized> Clone for $t<T> {
fn clone(&self) -> $t<T> {
$t
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T:?Sized> Default for $t<T> {
fn default() -> $t<T> {
$t
@@ -387,7 +401,9 @@ impls! { PhantomData }
mod impls {
use super::{Send, Sync, Sized};
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<'a, T: Sync + ?Sized> Send for &'a T {}
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<'a, T: Send + ?Sized> Send for &'a mut T {}
}
@@ -433,4 +449,7 @@ mod impls {
ensure all type parameters are bounded by `Any`"]
pub trait Reflect {}
#[unstable(feature = "reflect_marker",
reason = "requires RFC and more experience",
issue = "27749")]
impl Reflect for .. { }

View File

@@ -141,6 +141,9 @@ pub mod consts {
pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32;
}
#[unstable(feature = "core_float",
reason = "stable interface is via `impl f{32,64}` in later crates",
issue = "27702")]
impl Float for f32 {
#[inline]
fn nan() -> f32 { NAN }

View File

@@ -141,6 +141,9 @@ pub mod consts {
pub const LN_10: f64 = 2.30258509299404568401799145468436421_f64;
}
#[unstable(feature = "core_float",
reason = "stable interface is via `impl f{32,64}` in later crates",
issue = "27702")]
impl Float for f64 {
#[inline]
fn nan() -> f64 { NAN }

View File

@@ -77,10 +77,16 @@ pub trait One: Sized {
macro_rules! zero_one_impl {
($($t:ty)*) => ($(
#[unstable(feature = "zero_one",
reason = "unsure of placement, wants to use associated constants",
issue = "27739")]
impl Zero for $t {
#[inline]
fn zero() -> Self { 0 }
}
#[unstable(feature = "zero_one",
reason = "unsure of placement, wants to use associated constants",
issue = "27739")]
impl One for $t {
#[inline]
fn one() -> Self { 1 }
@@ -91,10 +97,16 @@ zero_one_impl! { u8 u16 u32 u64 usize i8 i16 i32 i64 isize }
macro_rules! zero_one_impl_float {
($($t:ty)*) => ($(
#[unstable(feature = "zero_one",
reason = "unsure of placement, wants to use associated constants",
issue = "27739")]
impl Zero for $t {
#[inline]
fn zero() -> Self { 0.0 }
}
#[unstable(feature = "zero_one",
reason = "unsure of placement, wants to use associated constants",
issue = "27739")]
impl One for $t {
#[inline]
fn one() -> Self { 1.0 }
@@ -1938,6 +1950,7 @@ impl fmt::Display for ParseIntError {
}
}
#[stable(feature = "rust1", since = "1.0.0")]
pub use num::dec2flt::ParseFloatError;
// Conversion traits for primitive integer and float types

View File

@@ -894,6 +894,7 @@ pub trait Shr<RHS> {
macro_rules! shr_impl {
($t:ty, $f:ty) => (
#[stable(feature = "rust1", since = "1.0.0")]
impl Shr<$f> for $t {
type Output = $t;
@@ -1731,6 +1732,7 @@ impl<'a, T: ?Sized> DerefMut for &'a mut T {
#[fundamental] // so that regex can rely that `&str: !FnMut`
pub trait Fn<Args> : FnMut<Args> {
/// This is called when the call operator is used.
#[unstable(feature = "core", issue = "27701")]
extern "rust-call" fn call(&self, args: Args) -> Self::Output;
}
@@ -1741,6 +1743,7 @@ pub trait Fn<Args> : FnMut<Args> {
#[fundamental] // so that regex can rely that `&str: !FnMut`
pub trait FnMut<Args> : FnOnce<Args> {
/// This is called when the call operator is used.
#[unstable(feature = "core", issue = "27701")]
extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
}
@@ -1751,9 +1754,11 @@ pub trait FnMut<Args> : FnOnce<Args> {
#[fundamental] // so that regex can rely that `&str: !FnMut`
pub trait FnOnce<Args> {
/// The returned type after the call operator is used.
#[unstable(feature = "core", issue = "27701")]
type Output;
/// This is called when the call operator is used.
#[unstable(feature = "core", issue = "27701")]
extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
}
@@ -1761,6 +1766,7 @@ mod impls {
use marker::Sized;
use super::{Fn, FnMut, FnOnce};
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a,A,F:?Sized> Fn<A> for &'a F
where F : Fn<A>
{
@@ -1769,6 +1775,7 @@ mod impls {
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a,A,F:?Sized> FnMut<A> for &'a F
where F : Fn<A>
{
@@ -1777,6 +1784,7 @@ mod impls {
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a,A,F:?Sized> FnOnce<A> for &'a F
where F : Fn<A>
{
@@ -1787,6 +1795,7 @@ mod impls {
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a,A,F:?Sized> FnMut<A> for &'a mut F
where F : FnMut<A>
{
@@ -1795,6 +1804,7 @@ mod impls {
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a,A,F:?Sized> FnOnce<A> for &'a mut F
where F : FnMut<A>
{
@@ -1814,25 +1824,34 @@ pub trait CoerceUnsized<T> {
}
// &mut T -> &mut U
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<&'a mut U> for &'a mut T {}
// &mut T -> &U
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<'a, 'b: 'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b mut T {}
// &mut T -> *mut U
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for &'a mut T {}
// &mut T -> *const U
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for &'a mut T {}
// &T -> &U
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<'a, 'b: 'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<&'a U> for &'b T {}
// &T -> *const U
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<'a, T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for &'a T {}
// *mut T -> *mut U
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*mut U> for *mut T {}
// *mut T -> *const U
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *mut T {}
// *const T -> *const U
#[unstable(feature = "coerce_unsized", issue = "27732")]
impl<T: ?Sized+Unsize<U>, U: ?Sized> CoerceUnsized<*const U> for *const T {}
/// Both `in (PLACE) EXPR` and `box EXPR` desugar into expressions

View File

@@ -17,23 +17,37 @@
#![stable(feature = "core_prelude", since = "1.4.0")]
// Reexported core operators
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)] pub use marker::{Copy, Send, Sized, Sync};
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)] pub use ops::{Drop, Fn, FnMut, FnOnce};
// Reexported functions
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)] pub use mem::drop;
// Reexported types and traits
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)] pub use clone::Clone;
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)] pub use cmp::{PartialEq, PartialOrd, Eq, Ord};
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)] pub use convert::{AsRef, AsMut, Into, From};
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)] pub use default::Default;
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)] pub use iter::{Iterator, Extend, IntoIterator};
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)] pub use iter::{DoubleEndedIterator, ExactSizeIterator};
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)] pub use option::Option::{self, Some, None};
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)] pub use result::Result::{self, Ok, Err};
// Reexported extension traits for primitive types
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)] pub use slice::SliceExt;
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)] pub use str::StrExt;
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)] pub use char::CharExt;

View File

@@ -40,6 +40,7 @@ pub use intrinsics::copy;
#[stable(feature = "rust1", since = "1.0.0")]
pub use intrinsics::write_bytes;
#[unstable(feature = "drop_in_place", reason = "just exposed, needs FCP", issue = "27908")]
pub use intrinsics::drop_in_place;
/// Creates a null raw pointer.

View File

@@ -870,6 +870,7 @@ impl<'a, T> DoubleEndedIterator for Iter<'a, T> {
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> ExactSizeIterator for Iter<'a, T> {}
#[stable(feature = "rust1", since = "1.0.0")]
impl<'a, T> Clone for Iter<'a, T> {
fn clone(&self) -> Iter<'a, T> { Iter { inner: self.inner } }
}

View File

@@ -154,6 +154,9 @@ macro_rules! slice_ref {
}};
}
#[unstable(feature = "core_slice_ext",
reason = "stable interface provided by `impl [T]` in later crates",
issue = "27701")]
impl<T> SliceExt for [T] {
type Item = T;
@@ -796,7 +799,9 @@ pub struct Iter<'a, T: 'a> {
_marker: marker::PhantomData<&'a T>,
}
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<'a, T: Sync> Sync for Iter<'a, T> {}
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<'a, T: Sync> Send for Iter<'a, T> {}
impl<'a, T> Iter<'a, T> {
@@ -842,7 +847,9 @@ pub struct IterMut<'a, T: 'a> {
_marker: marker::PhantomData<&'a mut T>,
}
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<'a, T: Sync> Sync for IterMut<'a, T> {}
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<'a, T: Send> Send for IterMut<'a, T> {}
impl<'a, T> IterMut<'a, T> {

View File

@@ -1440,6 +1440,9 @@ fn slice_error_fail(s: &str, begin: usize, end: usize) -> ! {
begin, end, s);
}
#[unstable(feature = "core_str_ext",
reason = "stable interface provided by `impl str` in later crates",
issue = "27701")]
impl StrExt for str {
#[inline]
fn contains<'a, P: Pattern<'a>>(&'a self, pat: P) -> bool {

View File

@@ -86,6 +86,7 @@ pub struct AtomicBool {
v: UnsafeCell<usize>,
}
#[stable(feature = "rust1", since = "1.0.0")]
impl Default for AtomicBool {
fn default() -> Self {
Self::new(Default::default())
@@ -93,6 +94,7 @@ impl Default for AtomicBool {
}
// Send is implicitly implemented for AtomicBool.
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl Sync for AtomicBool {}
/// A signed integer type which can be safely shared between threads.
@@ -101,6 +103,7 @@ pub struct AtomicIsize {
v: UnsafeCell<isize>,
}
#[stable(feature = "rust1", since = "1.0.0")]
impl Default for AtomicIsize {
fn default() -> Self {
Self::new(Default::default())
@@ -108,6 +111,7 @@ impl Default for AtomicIsize {
}
// Send is implicitly implemented for AtomicIsize.
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl Sync for AtomicIsize {}
/// An unsigned integer type which can be safely shared between threads.
@@ -116,6 +120,7 @@ pub struct AtomicUsize {
v: UnsafeCell<usize>,
}
#[stable(feature = "rust1", since = "1.0.0")]
impl Default for AtomicUsize {
fn default() -> Self {
Self::new(Default::default())
@@ -123,6 +128,7 @@ impl Default for AtomicUsize {
}
// Send is implicitly implemented for AtomicUsize.
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl Sync for AtomicUsize {}
/// A raw pointer type which can be safely shared between threads.
@@ -131,13 +137,16 @@ pub struct AtomicPtr<T> {
p: UnsafeCell<*mut T>,
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Default for AtomicPtr<T> {
fn default() -> AtomicPtr<T> {
AtomicPtr::new(::ptr::null_mut())
}
}
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T> Send for AtomicPtr<T> {}
#[stable(feature = "rust1", since = "1.0.0")]
unsafe impl<T> Sync for AtomicPtr<T> {}
/// Atomic memory orderings

View File

@@ -27,8 +27,6 @@
//! * `Ord`
//! * `Default`
#![stable(feature = "rust1", since = "1.0.0")]
use clone::Clone;
use cmp::*;
use cmp::Ordering::*;