diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2016-06-28 08:56:56 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2016-07-03 10:49:01 -0700 |
| commit | 3016626c3aa4bc44807e54a8ba8b9e367ff566f5 (patch) | |
| tree | 4dd6d30026ff2b9af406e1923e9f954da8e62690 /src/libstd/num | |
| parent | 375fa6ef371a0ae248968d363226101ef741127e (diff) | |
| download | rust-3016626c3aa4bc44807e54a8ba8b9e367ff566f5.tar.gz rust-3016626c3aa4bc44807e54a8ba8b9e367ff566f5.zip | |
std: Stabilize APIs for the 1.11.0 release
Although the set of APIs being stabilized this release is relatively small, the
trains keep going! Listed below are the APIs in the standard library which have
either transitioned from unstable to stable or those from unstable to
deprecated.
Stable
* `BTreeMap::{append, split_off}`
* `BTreeSet::{append, split_off}`
* `Cell::get_mut`
* `RefCell::get_mut`
* `BinaryHeap::append`
* `{f32, f64}::{to_degrees, to_radians}` - libcore stabilizations mirroring past
libstd stabilizations
* `Iterator::sum`
* `Iterator::product`
Deprecated
* `{f32, f64}::next_after`
* `{f32, f64}::integer_decode`
* `{f32, f64}::ldexp`
* `{f32, f64}::frexp`
* `num::One`
* `num::Zero`
Added APIs (all unstable)
* `iter::Sum`
* `iter::Product`
* `iter::Step` - a few methods were added to accomodate deprecation of One/Zero
Removed APIs
* `From<Range<T>> for RangeInclusive<T>` - everything about `RangeInclusive` is
unstable
Closes #27739
Closes #27752
Closes #32526
Closes #33444
Closes #34152
cc #34529 (new tracking issue)
Diffstat (limited to 'src/libstd/num')
| -rw-r--r-- | src/libstd/num/f32.rs | 19 | ||||
| -rw-r--r-- | src/libstd/num/f64.rs | 17 | ||||
| -rw-r--r-- | src/libstd/num/mod.rs | 7 |
3 files changed, 39 insertions, 4 deletions
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index 17d412411c0..7a676c041ad 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -110,6 +110,7 @@ mod cmath { } #[inline] + #[allow(deprecated)] pub unsafe fn frexpf(x: c_float, value: &mut c_int) -> c_float { let (a, b) = f64::frexp(x as f64); *value = b as c_int; @@ -117,6 +118,7 @@ mod cmath { } #[inline] + #[allow(deprecated)] pub unsafe fn ldexpf(x: c_float, n: c_int) -> c_float { f64::ldexp(x as f64, n as isize) as c_float } @@ -265,7 +267,11 @@ impl f32 { /// [floating-point]: ../reference.html#machine-types #[unstable(feature = "float_extras", reason = "signature is undecided", issue = "27752")] + #[rustc_deprecated(since = "1.11.0", + reason = "never really came to fruition and easily \ + implementable outside the standard library")] #[inline] + #[allow(deprecated)] pub fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self) } @@ -718,6 +724,9 @@ impl f32 { #[unstable(feature = "float_extras", reason = "pending integer conventions", issue = "27752")] + #[rustc_deprecated(since = "1.11.0", + reason = "never really came to fruition and easily \ + implementable outside the standard library")] #[inline] pub fn ldexp(x: f32, exp: isize) -> f32 { unsafe { cmath::ldexpf(x, exp as c_int) } @@ -747,6 +756,9 @@ impl f32 { #[unstable(feature = "float_extras", reason = "pending integer conventions", issue = "27752")] + #[rustc_deprecated(since = "1.11.0", + reason = "never really came to fruition and easily \ + implementable outside the standard library")] #[inline] pub fn frexp(self) -> (f32, isize) { unsafe { @@ -773,6 +785,9 @@ impl f32 { #[unstable(feature = "float_extras", reason = "unsure about its place in the world", issue = "27752")] + #[rustc_deprecated(since = "1.11.0", + reason = "never really came to fruition and easily \ + implementable outside the standard library")] #[inline] pub fn next_after(self, other: f32) -> f32 { unsafe { cmath::nextafterf(self, other) } @@ -1384,6 +1399,7 @@ mod tests { } #[test] + #[allow(deprecated)] fn test_integer_decode() { assert_eq!(3.14159265359f32.integer_decode(), (13176795, -22, 1)); assert_eq!((-8573.5918555f32).integer_decode(), (8779358, -10, -1)); @@ -1711,6 +1727,7 @@ mod tests { } #[test] + #[allow(deprecated)] fn test_ldexp() { let f1 = 2.0f32.powi(-123); let f2 = 2.0f32.powi(-111); @@ -1731,6 +1748,7 @@ mod tests { } #[test] + #[allow(deprecated)] fn test_frexp() { let f1 = 2.0f32.powi(-123); let f2 = 2.0f32.powi(-111); @@ -1750,6 +1768,7 @@ mod tests { } #[test] #[cfg_attr(windows, ignore)] // FIXME #8755 + #[allow(deprecated)] fn test_frexp_nowin() { let inf: f32 = f32::INFINITY; let neg_inf: f32 = f32::NEG_INFINITY; diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index 70b7706535c..67a1c302483 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -209,7 +209,11 @@ impl f64 { /// [floating-point]: ../reference.html#machine-types #[unstable(feature = "float_extras", reason = "signature is undecided", issue = "27752")] + #[rustc_deprecated(since = "1.11.0", + reason = "never really came to fruition and easily \ + implementable outside the standard library")] #[inline] + #[allow(deprecated)] pub fn integer_decode(self) -> (u64, i16, i8) { num::Float::integer_decode(self) } /// Returns the largest integer less than or equal to a number. @@ -613,6 +617,9 @@ impl f64 { #[unstable(feature = "float_extras", reason = "pending integer conventions", issue = "27752")] + #[rustc_deprecated(since = "1.11.0", + reason = "never really came to fruition and easily \ + implementable outside the standard library")] #[inline] pub fn ldexp(x: f64, exp: isize) -> f64 { unsafe { cmath::ldexp(x, exp as c_int) } @@ -640,6 +647,9 @@ impl f64 { #[unstable(feature = "float_extras", reason = "pending integer conventions", issue = "27752")] + #[rustc_deprecated(since = "1.11.0", + reason = "never really came to fruition and easily \ + implementable outside the standard library")] #[inline] pub fn frexp(self) -> (f64, isize) { unsafe { @@ -664,6 +674,9 @@ impl f64 { #[unstable(feature = "float_extras", reason = "unsure about its place in the world", issue = "27752")] + #[rustc_deprecated(since = "1.11.0", + reason = "never really came to fruition and easily \ + implementable outside the standard library")] #[inline] pub fn next_after(self, other: f64) -> f64 { unsafe { cmath::nextafter(self, other) } @@ -1277,6 +1290,7 @@ mod tests { } #[test] + #[allow(deprecated)] fn test_integer_decode() { assert_eq!(3.14159265359f64.integer_decode(), (7074237752028906, -51, 1)); assert_eq!((-8573.5918555f64).integer_decode(), (4713381968463931, -39, -1)); @@ -1604,6 +1618,7 @@ mod tests { } #[test] + #[allow(deprecated)] fn test_ldexp() { let f1 = 2.0f64.powi(-123); let f2 = 2.0f64.powi(-111); @@ -1624,6 +1639,7 @@ mod tests { } #[test] + #[allow(deprecated)] fn test_frexp() { let f1 = 2.0f64.powi(-123); let f2 = 2.0f64.powi(-111); @@ -1643,6 +1659,7 @@ mod tests { } #[test] #[cfg_attr(windows, ignore)] // FIXME #8755 + #[allow(deprecated)] fn test_frexp_nowin() { let inf: f64 = INFINITY; let neg_inf: f64 = NEG_INFINITY; diff --git a/src/libstd/num/mod.rs b/src/libstd/num/mod.rs index d33df05acf2..20804d62dfa 100644 --- a/src/libstd/num/mod.rs +++ b/src/libstd/num/mod.rs @@ -17,6 +17,7 @@ #![allow(missing_docs)] #[stable(feature = "rust1", since = "1.0.0")] +#[allow(deprecated)] pub use core::num::{Zero, One}; #[stable(feature = "rust1", since = "1.0.0")] pub use core::num::{FpCategory, ParseIntError, ParseFloatError, TryFromIntError}; @@ -46,7 +47,6 @@ pub fn test_num<T>(ten: T, two: T) where #[cfg(test)] mod tests { - use super::*; use u8; use u16; use u32; @@ -198,15 +198,14 @@ mod tests { #[test] fn test_pow() { - fn naive_pow<T: Mul<Output=T> + One + Copy>(base: T, exp: usize) -> T { - let one: T = T::one(); + fn naive_pow<T: Mul<Output=T> + Copy>(one: T, base: T, exp: usize) -> T { (0..exp).fold(one, |acc, _| acc * base) } macro_rules! assert_pow { (($num:expr, $exp:expr) => $expected:expr) => {{ let result = $num.pow($exp); assert_eq!(result, $expected); - assert_eq!(result, naive_pow($num, $exp)); + assert_eq!(result, naive_pow(1, $num, $exp)); }} } assert_pow!((3u32, 0 ) => 1); |
