diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-06-09 11:18:03 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-06-17 09:06:59 -0700 |
| commit | c14d86fd3ff3ba2d01a6e859290b30e74081313b (patch) | |
| tree | 79ec999c2885ff0d2f3b9836be5938bc0d6339b4 /src/libcore/num | |
| parent | e7a5a1c33a7794a97eb11a38cc576375a3553a64 (diff) | |
| download | rust-c14d86fd3ff3ba2d01a6e859290b30e74081313b.tar.gz rust-c14d86fd3ff3ba2d01a6e859290b30e74081313b.zip | |
core: Split apart the global `core` feature
This commit shards the broad `core` feature of the libcore library into finer grained features. This split groups together similar APIs and enables tracking each API separately, giving a better sense of where each feature is within the stabilization process. A few minor APIs were deprecated along the way: * Iterator::reverse_in_place * marker::NoCopy
Diffstat (limited to 'src/libcore/num')
| -rw-r--r-- | src/libcore/num/f32.rs | 4 | ||||
| -rw-r--r-- | src/libcore/num/f64.rs | 4 | ||||
| -rw-r--r-- | src/libcore/num/flt2dec/mod.rs | 2 | ||||
| -rw-r--r-- | src/libcore/num/int_macros.rs | 6 | ||||
| -rw-r--r-- | src/libcore/num/mod.rs | 33 | ||||
| -rw-r--r-- | src/libcore/num/uint_macros.rs | 6 | ||||
| -rw-r--r-- | src/libcore/num/wrapping.rs | 2 |
7 files changed, 34 insertions, 23 deletions
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index 50dd3f1661a..229414fe766 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -71,7 +71,8 @@ pub mod consts { pub const PI: f32 = 3.14159265358979323846264338327950288_f32; /// pi * 2.0 - #[unstable(feature = "core", reason = "unclear naming convention/usefulness")] + #[unstable(feature = "float_consts", + reason = "unclear naming convention/usefulness")] pub const PI_2: f32 = 6.28318530717958647692528676655900576_f32; /// pi/2.0 @@ -135,7 +136,6 @@ pub mod consts { pub const LN_10: f32 = 2.30258509299404568401799145468436421_f32; } -#[unstable(feature = "core", reason = "trait is unstable")] impl Float for f32 { #[inline] fn nan() -> f32 { NAN } diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index 62b566e7eb4..bbc1bdacde7 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -71,7 +71,8 @@ pub mod consts { pub const PI: f64 = 3.14159265358979323846264338327950288_f64; /// pi * 2.0 - #[unstable(feature = "core", reason = "unclear naming convention/usefulness")] + #[unstable(feature = "float_consts", + reason = "unclear naming convention/usefulness")] pub const PI_2: f64 = 6.28318530717958647692528676655900576_f64; /// pi/2.0 @@ -135,7 +136,6 @@ pub mod consts { pub const LN_10: f64 = 2.30258509299404568401799145468436421_f64; } -#[unstable(feature = "core", reason = "trait is unstable")] impl Float for f64 { #[inline] fn nan() -> f64 { NAN } diff --git a/src/libcore/num/flt2dec/mod.rs b/src/libcore/num/flt2dec/mod.rs index f51dcf54a19..f3a7e8f09a9 100644 --- a/src/libcore/num/flt2dec/mod.rs +++ b/src/libcore/num/flt2dec/mod.rs @@ -126,6 +126,8 @@ functions. // while this is extensively documented, this is in principle private which is // only made public for testing. do not expose us. #![doc(hidden)] +#![unstable(feature = "flt2dec", + reason = "internal routines only exposed for testing")] use prelude::*; use i16; diff --git a/src/libcore/num/int_macros.rs b/src/libcore/num/int_macros.rs index 3113521e0af..efc91238809 100644 --- a/src/libcore/num/int_macros.rs +++ b/src/libcore/num/int_macros.rs @@ -14,11 +14,13 @@ macro_rules! int_module { ($T:ty, $bits:expr) => ( // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of // calling the `mem::size_of` function. -#[unstable(feature = "core")] +#[unstable(feature = "num_bits_bytes", + reason = "may want to be an associated function")] pub const BITS : usize = $bits; // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of // calling the `mem::size_of` function. -#[unstable(feature = "core")] +#[unstable(feature = "num_bits_bytes", + reason = "may want to be an associated function")] pub const BYTES : usize = ($bits / 8); // FIXME(#11621): Should be deprecated once CTFE is implemented in favour of diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs index bf26022692d..c8a0ae47637 100644 --- a/src/libcore/num/mod.rs +++ b/src/libcore/num/mod.rs @@ -41,10 +41,7 @@ use str::{FromStr, StrExt}; #[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Copy, Debug)] pub struct Wrapping<T>(#[stable(feature = "rust1", since = "1.0.0")] pub T); -#[unstable(feature = "core", reason = "may be removed or relocated")] pub mod wrapping; - -#[unstable(feature = "core", reason = "internal routines only exposed for testing")] pub mod flt2dec; /// Types that have a "zero" value. @@ -471,7 +468,7 @@ macro_rules! int_impl { /// to `-MIN`, a positive value that is too large to represent /// in the type. In such a case, this function returns `MIN` /// itself.. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_div(self, rhs: Self) -> Self { self.overflowing_div(rhs).0 @@ -484,7 +481,7 @@ macro_rules! int_impl { /// implementation artifacts make `x % y` illegal for `MIN / /// -1` on a signed type illegal (where `MIN` is the negative /// minimal value). In such a case, this function returns `0`. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_rem(self, rhs: Self) -> Self { self.overflowing_rem(rhs).0 @@ -498,7 +495,7 @@ macro_rules! int_impl { /// negative minimal value for the type); this is a positive /// value that is too large to represent in the type. In such /// a case, this function returns `MIN` itself. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_neg(self) -> Self { self.overflowing_neg().0 @@ -507,7 +504,7 @@ macro_rules! int_impl { /// Panic-free bitwise shift-left; yields `self << mask(rhs)`, /// where `mask` removes any high-order bits of `rhs` that /// would cause the shift to exceed the bitwidth of the type. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_shl(self, rhs: u32) -> Self { self.overflowing_shl(rhs).0 @@ -516,7 +513,7 @@ macro_rules! int_impl { /// Panic-free bitwise shift-left; yields `self >> mask(rhs)`, /// where `mask` removes any high-order bits of `rhs` that /// would cause the shift to exceed the bitwidth of the type. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_shr(self, rhs: u32) -> Self { self.overflowing_shr(rhs).0 @@ -1041,7 +1038,7 @@ macro_rules! uint_impl { /// to `-MIN`, a positive value that is too large to represent /// in the type. In such a case, this function returns `MIN` /// itself.. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_div(self, rhs: Self) -> Self { self.overflowing_div(rhs).0 @@ -1054,7 +1051,7 @@ macro_rules! uint_impl { /// implementation artifacts make `x % y` illegal for `MIN / /// -1` on a signed type illegal (where `MIN` is the negative /// minimal value). In such a case, this function returns `0`. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_rem(self, rhs: Self) -> Self { self.overflowing_rem(rhs).0 @@ -1068,7 +1065,7 @@ macro_rules! uint_impl { /// negative minimal value for the type); this is a positive /// value that is too large to represent in the type. In such /// a case, this function returns `MIN` itself. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_neg(self) -> Self { self.overflowing_neg().0 @@ -1077,7 +1074,7 @@ macro_rules! uint_impl { /// Panic-free bitwise shift-left; yields `self << mask(rhs)`, /// where `mask` removes any high-order bits of `rhs` that /// would cause the shift to exceed the bitwidth of the type. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_shl(self, rhs: u32) -> Self { self.overflowing_shl(rhs).0 @@ -1086,7 +1083,7 @@ macro_rules! uint_impl { /// Panic-free bitwise shift-left; yields `self >> mask(rhs)`, /// where `mask` removes any high-order bits of `rhs` that /// would cause the shift to exceed the bitwidth of the type. - #[unstable(feature = "core", since = "1.0.0")] + #[unstable(feature = "num_wrapping")] #[inline(always)] pub fn wrapping_shr(self, rhs: u32) -> Self { self.overflowing_shr(rhs).0 @@ -1262,6 +1259,8 @@ pub enum FpCategory { /// A built-in floating point number. #[doc(hidden)] +#[unstable(feature = "core_float", + reason = "stable interface is via `impl f{32,64}` in later crates")] pub trait Float { /// Returns the NaN value. fn nan() -> Self; @@ -1512,7 +1511,9 @@ enum IntErrorKind { } impl ParseIntError { - #[unstable(feature = "core", reason = "available through Error trait")] + #[unstable(feature = "int_error_internals", + reason = "available through Error trait and this method should \ + not be exposed publicly")] pub fn description(&self) -> &str { match self.kind { IntErrorKind::Empty => "cannot parse integer from empty string", @@ -1535,10 +1536,14 @@ impl fmt::Display for ParseIntError { #[stable(feature = "rust1", since = "1.0.0")] pub struct ParseFloatError { #[doc(hidden)] + #[unstable(feature = "float_error_internals", + reason = "should not be exposed publicly")] pub __kind: FloatErrorKind } #[derive(Debug, Clone, PartialEq)] +#[unstable(feature = "float_error_internals", + reason = "should not be exposed publicly")] pub enum FloatErrorKind { Empty, Invalid, diff --git a/src/libcore/num/uint_macros.rs b/src/libcore/num/uint_macros.rs index 86782950745..0719d7c17cc 100644 --- a/src/libcore/num/uint_macros.rs +++ b/src/libcore/num/uint_macros.rs @@ -12,9 +12,11 @@ macro_rules! uint_module { ($T:ty, $T_SIGNED:ty, $bits:expr) => ( -#[unstable(feature = "core")] +#[unstable(feature = "num_bits_bytes", + reason = "may want to be an associated function")] pub const BITS : usize = $bits; -#[unstable(feature = "core")] +#[unstable(feature = "num_bits_bytes", + reason = "may want to be an associated function")] pub const BYTES : usize = ($bits / 8); #[stable(feature = "rust1", since = "1.0.0")] diff --git a/src/libcore/num/wrapping.rs b/src/libcore/num/wrapping.rs index 69c22229490..748ed29e3a3 100644 --- a/src/libcore/num/wrapping.rs +++ b/src/libcore/num/wrapping.rs @@ -10,6 +10,7 @@ #![allow(missing_docs)] #![allow(deprecated)] +#![unstable(feature = "wrapping", reason = "may be removed or relocated")] use super::Wrapping; @@ -30,7 +31,6 @@ use intrinsics::{i64_mul_with_overflow, u64_mul_with_overflow}; use ::{i8,i16,i32,i64}; -#[unstable(feature = "core", reason = "may be removed, renamed, or relocated")] pub trait OverflowingOps { fn overflowing_add(self, rhs: Self) -> (Self, bool); fn overflowing_sub(self, rhs: Self) -> (Self, bool); |
