diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-02-05 09:14:45 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-05 09:14:45 -0500 |
| commit | 65b24779a95d306ac9abd73bf430380e925e765e (patch) | |
| tree | 57ea8308bbbb9640b475daa483f7dd232ea531a4 /src/libcore | |
| parent | 5cfd5eda97d69e04cd4f92d500dbcbbc114178f4 (diff) | |
| parent | 9128f6100c9bfe2c2c22d85ccec92f01166f5d25 (diff) | |
| download | rust-65b24779a95d306ac9abd73bf430380e925e765e.tar.gz rust-65b24779a95d306ac9abd73bf430380e925e765e.zip | |
Rollup merge of #39393 - ollie27:stab_impls, r=alexcrichton
Fix a few impl stability attributes The versions show up in rustdoc.
Diffstat (limited to 'src/libcore')
| -rw-r--r-- | src/libcore/char.rs | 6 | ||||
| -rw-r--r-- | src/libcore/internal_macros.rs | 16 | ||||
| -rw-r--r-- | src/libcore/iter/traits.rs | 18 | ||||
| -rw-r--r-- | src/libcore/num/int_macros.rs | 6 | ||||
| -rw-r--r-- | src/libcore/num/uint_macros.rs | 6 | ||||
| -rw-r--r-- | src/libcore/num/wrapping.rs | 30 | ||||
| -rw-r--r-- | src/libcore/slice.rs | 14 |
7 files changed, 59 insertions, 37 deletions
diff --git a/src/libcore/char.rs b/src/libcore/char.rs index 367422f5536..78764091cf0 100644 --- a/src/libcore/char.rs +++ b/src/libcore/char.rs @@ -588,7 +588,7 @@ impl ExactSizeIterator for EscapeUnicode { #[unstable(feature = "fused", issue = "35602")] impl FusedIterator for EscapeUnicode {} -#[stable(feature = "char_struct_display", since = "1.17.0")] +#[stable(feature = "char_struct_display", since = "1.16.0")] impl fmt::Display for EscapeUnicode { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { for c in self.clone() { @@ -701,7 +701,7 @@ impl ExactSizeIterator for EscapeDefault { #[unstable(feature = "fused", issue = "35602")] impl FusedIterator for EscapeDefault {} -#[stable(feature = "char_struct_display", since = "1.17.0")] +#[stable(feature = "char_struct_display", since = "1.16.0")] impl fmt::Display for EscapeDefault { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { for c in self.clone() { @@ -735,7 +735,7 @@ impl ExactSizeIterator for EscapeDebug { } #[unstable(feature = "fused", issue = "35602")] impl FusedIterator for EscapeDebug {} -#[stable(feature = "char_struct_display", since = "1.17.0")] +#[unstable(feature = "char_escape_debug", issue = "35068")] impl fmt::Display for EscapeDebug { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&self.0, f) diff --git a/src/libcore/internal_macros.rs b/src/libcore/internal_macros.rs index f2cdc9d6a98..9a7914064fd 100644 --- a/src/libcore/internal_macros.rs +++ b/src/libcore/internal_macros.rs @@ -13,7 +13,11 @@ // based on "op T" where T is expected to be `Copy`able macro_rules! forward_ref_unop { (impl $imp:ident, $method:ident for $t:ty) => { - #[stable(feature = "rust1", since = "1.0.0")] + forward_ref_unop!(impl $imp, $method for $t, + #[stable(feature = "rust1", since = "1.0.0")]); + }; + (impl $imp:ident, $method:ident for $t:ty, #[$attr:meta]) => { + #[$attr] impl<'a> $imp for &'a $t { type Output = <$t as $imp>::Output; @@ -29,7 +33,11 @@ macro_rules! forward_ref_unop { // based on "T op U" where T and U are expected to be `Copy`able macro_rules! forward_ref_binop { (impl $imp:ident, $method:ident for $t:ty, $u:ty) => { - #[stable(feature = "rust1", since = "1.0.0")] + forward_ref_binop!(impl $imp, $method for $t, $u, + #[stable(feature = "rust1", since = "1.0.0")]); + }; + (impl $imp:ident, $method:ident for $t:ty, $u:ty, #[$attr:meta]) => { + #[$attr] impl<'a> $imp<$u> for &'a $t { type Output = <$t as $imp<$u>>::Output; @@ -39,7 +47,7 @@ macro_rules! forward_ref_binop { } } - #[stable(feature = "rust1", since = "1.0.0")] + #[$attr] impl<'a> $imp<&'a $u> for $t { type Output = <$t as $imp<$u>>::Output; @@ -49,7 +57,7 @@ macro_rules! forward_ref_binop { } } - #[stable(feature = "rust1", since = "1.0.0")] + #[$attr] impl<'a, 'b> $imp<&'a $u> for &'b $t { type Output = <$t as $imp<$u>>::Output; diff --git a/src/libcore/iter/traits.rs b/src/libcore/iter/traits.rs index a86ceb9ac0d..cb180110d3c 100644 --- a/src/libcore/iter/traits.rs +++ b/src/libcore/iter/traits.rs @@ -661,29 +661,29 @@ pub trait Product<A = Self>: Sized { // NB: explicitly use Add and Mul here to inherit overflow checks macro_rules! integer_sum_product { - (@impls $zero:expr, $one:expr, $($a:ty)*) => ($( - #[stable(feature = "iter_arith_traits", since = "1.12.0")] + (@impls $zero:expr, $one:expr, #[$attr:meta], $($a:ty)*) => ($( + #[$attr] impl Sum for $a { fn sum<I: Iterator<Item=$a>>(iter: I) -> $a { iter.fold($zero, Add::add) } } - #[stable(feature = "iter_arith_traits", since = "1.12.0")] + #[$attr] impl Product for $a { fn product<I: Iterator<Item=$a>>(iter: I) -> $a { iter.fold($one, Mul::mul) } } - #[stable(feature = "iter_arith_traits", since = "1.12.0")] + #[$attr] impl<'a> Sum<&'a $a> for $a { fn sum<I: Iterator<Item=&'a $a>>(iter: I) -> $a { iter.fold($zero, Add::add) } } - #[stable(feature = "iter_arith_traits", since = "1.12.0")] + #[$attr] impl<'a> Product<&'a $a> for $a { fn product<I: Iterator<Item=&'a $a>>(iter: I) -> $a { iter.fold($one, Mul::mul) @@ -691,8 +691,12 @@ macro_rules! integer_sum_product { } )*); ($($a:ty)*) => ( - integer_sum_product!(@impls 0, 1, $($a)+); - integer_sum_product!(@impls Wrapping(0), Wrapping(1), $(Wrapping<$a>)+); + integer_sum_product!(@impls 0, 1, + #[stable(feature = "iter_arith_traits", since = "1.12.0")], + $($a)+); + integer_sum_product!(@impls Wrapping(0), Wrapping(1), + #[stable(feature = "wrapping_iter_arith", since = "1.14.0")], + $(Wrapping<$a>)+); ); } diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs index 04311d687ea..3b1612a4ee2 100644 --- a/src/libcore/num/int_macros.rs +++ b/src/libcore/num/int_macros.rs @@ -12,12 +12,12 @@ macro_rules! int_module { ($T:ident) => (int_module!($T, #[stable(feature = "rust1", since = "1.0.0")]);); - ($T:ident, $($attr: tt)*) => ( + ($T:ident, #[$attr:meta]) => ( /// The smallest value that can be represented by this integer type. - $($attr)* + #[$attr] pub const MIN: $T = $T::min_value(); /// The largest value that can be represented by this integer type. - $($attr)* + #[$attr] pub const MAX: $T = $T::max_value(); ) } diff --git a/src/libcore/num/uint_macros.rs b/src/libcore/num/uint_macros.rs index 2e59b39278a..f7e1f78d69e 100644 --- a/src/libcore/num/uint_macros.rs +++ b/src/libcore/num/uint_macros.rs @@ -12,12 +12,12 @@ macro_rules! uint_module { ($T:ident) => (uint_module!($T, #[stable(feature = "rust1", since = "1.0.0")]);); - ($T:ident, $($attr: tt)*) => ( + ($T:ident, #[$attr:meta]) => ( /// The smallest value that can be represented by this integer type. - $($attr)* + #[$attr] pub const MIN: $T = $T::min_value(); /// The largest value that can be represented by this integer type. - $($attr)* + #[$attr] pub const MAX: $T = $T::max_value(); ) } diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index 50007c7d9b0..013f02685ba 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -131,7 +131,8 @@ macro_rules! wrapping_impl { Wrapping(self.0.wrapping_add(other.0)) } } - forward_ref_binop! { impl Add, add for Wrapping<$t>, Wrapping<$t> } + forward_ref_binop! { impl Add, add for Wrapping<$t>, Wrapping<$t>, + #[stable(feature = "wrapping_ref", since = "1.14.0")] } #[stable(feature = "op_assign_traits", since = "1.8.0")] impl AddAssign for Wrapping<$t> { @@ -150,7 +151,8 @@ macro_rules! wrapping_impl { Wrapping(self.0.wrapping_sub(other.0)) } } - forward_ref_binop! { impl Sub, sub for Wrapping<$t>, Wrapping<$t> } + forward_ref_binop! { impl Sub, sub for Wrapping<$t>, Wrapping<$t>, + #[stable(feature = "wrapping_ref", since = "1.14.0")] } #[stable(feature = "op_assign_traits", since = "1.8.0")] impl SubAssign for Wrapping<$t> { @@ -169,7 +171,8 @@ macro_rules! wrapping_impl { Wrapping(self.0.wrapping_mul(other.0)) } } - forward_ref_binop! { impl Mul, mul for Wrapping<$t>, Wrapping<$t> } + forward_ref_binop! { impl Mul, mul for Wrapping<$t>, Wrapping<$t>, + #[stable(feature = "wrapping_ref", since = "1.14.0")] } #[stable(feature = "op_assign_traits", since = "1.8.0")] impl MulAssign for Wrapping<$t> { @@ -188,7 +191,8 @@ macro_rules! wrapping_impl { Wrapping(self.0.wrapping_div(other.0)) } } - forward_ref_binop! { impl Div, div for Wrapping<$t>, Wrapping<$t> } + forward_ref_binop! { impl Div, div for Wrapping<$t>, Wrapping<$t>, + #[stable(feature = "wrapping_ref", since = "1.14.0")] } #[stable(feature = "op_assign_traits", since = "1.8.0")] impl DivAssign for Wrapping<$t> { @@ -207,7 +211,8 @@ macro_rules! wrapping_impl { Wrapping(self.0.wrapping_rem(other.0)) } } - forward_ref_binop! { impl Rem, rem for Wrapping<$t>, Wrapping<$t> } + forward_ref_binop! { impl Rem, rem for Wrapping<$t>, Wrapping<$t>, + #[stable(feature = "wrapping_ref", since = "1.14.0")] } #[stable(feature = "op_assign_traits", since = "1.8.0")] impl RemAssign for Wrapping<$t> { @@ -226,7 +231,8 @@ macro_rules! wrapping_impl { Wrapping(!self.0) } } - forward_ref_unop! { impl Not, not for Wrapping<$t> } + forward_ref_unop! { impl Not, not for Wrapping<$t>, + #[stable(feature = "wrapping_ref", since = "1.14.0")] } #[stable(feature = "rust1", since = "1.0.0")] impl BitXor for Wrapping<$t> { @@ -237,7 +243,8 @@ macro_rules! wrapping_impl { Wrapping(self.0 ^ other.0) } } - forward_ref_binop! { impl BitXor, bitxor for Wrapping<$t>, Wrapping<$t> } + forward_ref_binop! { impl BitXor, bitxor for Wrapping<$t>, Wrapping<$t>, + #[stable(feature = "wrapping_ref", since = "1.14.0")] } #[stable(feature = "op_assign_traits", since = "1.8.0")] impl BitXorAssign for Wrapping<$t> { @@ -256,7 +263,8 @@ macro_rules! wrapping_impl { Wrapping(self.0 | other.0) } } - forward_ref_binop! { impl BitOr, bitor for Wrapping<$t>, Wrapping<$t> } + forward_ref_binop! { impl BitOr, bitor for Wrapping<$t>, Wrapping<$t>, + #[stable(feature = "wrapping_ref", since = "1.14.0")] } #[stable(feature = "op_assign_traits", since = "1.8.0")] impl BitOrAssign for Wrapping<$t> { @@ -275,7 +283,8 @@ macro_rules! wrapping_impl { Wrapping(self.0 & other.0) } } - forward_ref_binop! { impl BitAnd, bitand for Wrapping<$t>, Wrapping<$t> } + forward_ref_binop! { impl BitAnd, bitand for Wrapping<$t>, Wrapping<$t>, + #[stable(feature = "wrapping_ref", since = "1.14.0")] } #[stable(feature = "op_assign_traits", since = "1.8.0")] impl BitAndAssign for Wrapping<$t> { @@ -293,7 +302,8 @@ macro_rules! wrapping_impl { Wrapping(0) - self } } - forward_ref_unop! { impl Neg, neg for Wrapping<$t> } + forward_ref_unop! { impl Neg, neg for Wrapping<$t>, + #[stable(feature = "wrapping_ref", since = "1.14.0")] } )*) } diff --git a/src/libcore/slice.rs b/src/libcore/slice.rs index b942d85f980..1a482b75731 100644 --- a/src/libcore/slice.rs +++ b/src/libcore/slice.rs @@ -616,7 +616,7 @@ pub trait SliceIndex<T> { fn index_mut(self, slice: &mut [T]) -> &mut Self::Output; } -#[stable(feature = "slice-get-slice-impls", since = "1.13.0")] +#[stable(feature = "slice-get-slice-impls", since = "1.15.0")] impl<T> SliceIndex<T> for usize { type Output = T; @@ -665,7 +665,7 @@ impl<T> SliceIndex<T> for usize { } } -#[stable(feature = "slice-get-slice-impls", since = "1.13.0")] +#[stable(feature = "slice-get-slice-impls", since = "1.15.0")] impl<T> SliceIndex<T> for ops::Range<usize> { type Output = [T]; @@ -726,7 +726,7 @@ impl<T> SliceIndex<T> for ops::Range<usize> { } } -#[stable(feature = "slice-get-slice-impls", since = "1.13.0")] +#[stable(feature = "slice-get-slice-impls", since = "1.15.0")] impl<T> SliceIndex<T> for ops::RangeTo<usize> { type Output = [T]; @@ -761,7 +761,7 @@ impl<T> SliceIndex<T> for ops::RangeTo<usize> { } } -#[stable(feature = "slice-get-slice-impls", since = "1.13.0")] +#[stable(feature = "slice-get-slice-impls", since = "1.15.0")] impl<T> SliceIndex<T> for ops::RangeFrom<usize> { type Output = [T]; @@ -796,7 +796,7 @@ impl<T> SliceIndex<T> for ops::RangeFrom<usize> { } } -#[stable(feature = "slice-get-slice-impls", since = "1.13.0")] +#[stable(feature = "slice-get-slice-impls", since = "1.15.0")] impl<T> SliceIndex<T> for ops::RangeFull { type Output = [T]; @@ -832,7 +832,7 @@ impl<T> SliceIndex<T> for ops::RangeFull { } -#[stable(feature = "slice-get-slice-impls", since = "1.13.0")] +#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")] impl<T> SliceIndex<T> for ops::RangeInclusive<usize> { type Output = [T]; @@ -895,7 +895,7 @@ impl<T> SliceIndex<T> for ops::RangeInclusive<usize> { } } -#[stable(feature = "slice-get-slice-impls", since = "1.13.0")] +#[unstable(feature = "inclusive_range", reason = "recently added, follows RFC", issue = "28237")] impl<T> SliceIndex<T> for ops::RangeToInclusive<usize> { type Output = [T]; |
