From 8506784d74603ddbe3e37aeb4f9191afc28b5205 Mon Sep 17 00:00:00 2001 From: bjorn3 Date: Fri, 26 Jul 2019 12:22:58 +0200 Subject: [PATCH] Reduce patching of libcore a bit These parts are no longer necessary as of #627 --- ...002-Disable-u128-and-i128-in-libcore.patch | 203 ------------------ 1 file changed, 203 deletions(-) diff --git a/patches/0002-Disable-u128-and-i128-in-libcore.patch b/patches/0002-Disable-u128-and-i128-in-libcore.patch index 97ed483f7d7..0e663c0482b 100644 --- a/patches/0002-Disable-u128-and-i128-in-libcore.patch +++ b/patches/0002-Disable-u128-and-i128-in-libcore.patch @@ -68,209 +68,6 @@ index d0ee5fa..d02c454 100644 #[cfg(target_pointer_width = "16")] macro_rules! ptr_width { () => { 2 } -diff --git a/src/libcore/time.rs b/src/libcore/time.rs -index ae6d807..4414e07 100644 ---- a/src/libcore/time.rs -+++ b/src/libcore/time.rs -@@ -534,198 +534,6 @@ impl Duration { - pub const fn as_secs_f32(&self) -> f32 { - (self.secs as f32) + (self.nanos as f32) / (NANOS_PER_SEC as f32) - } -- -- /// Creates a new `Duration` from the specified number of seconds represented -- /// as `f64`. -- /// -- /// # Panics -- /// This constructor will panic if `secs` is not finite, negative or overflows `Duration`. -- /// -- /// # Examples -- /// ``` -- /// #![feature(duration_float)] -- /// use std::time::Duration; -- /// -- /// let dur = Duration::from_secs_f64(2.7); -- /// assert_eq!(dur, Duration::new(2, 700_000_000)); -- /// ``` -- #[unstable(feature = "duration_float", issue = "54361")] -- #[inline] -- pub fn from_secs_f64(secs: f64) -> Duration { -- const MAX_NANOS_F64: f64 = -- ((u64::MAX as u128 + 1)*(NANOS_PER_SEC as u128)) as f64; -- let nanos = secs * (NANOS_PER_SEC as f64); -- if !nanos.is_finite() { -- panic!("got non-finite value when converting float to duration"); -- } -- if nanos >= MAX_NANOS_F64 { -- panic!("overflow when converting float to duration"); -- } -- if nanos < 0.0 { -- panic!("underflow when converting float to duration"); -- } -- let nanos = nanos as u128; -- Duration { -- secs: (nanos / (NANOS_PER_SEC as u128)) as u64, -- nanos: (nanos % (NANOS_PER_SEC as u128)) as u32, -- } -- } -- -- /// Creates a new `Duration` from the specified number of seconds represented -- /// as `f32`. -- /// -- /// # Panics -- /// This constructor will panic if `secs` is not finite, negative or overflows `Duration`. -- /// -- /// # Examples -- /// ``` -- /// #![feature(duration_float)] -- /// use std::time::Duration; -- /// -- /// let dur = Duration::from_secs_f32(2.7); -- /// assert_eq!(dur, Duration::new(2, 700_000_000)); -- /// ``` -- #[unstable(feature = "duration_float", issue = "54361")] -- #[inline] -- pub fn from_secs_f32(secs: f32) -> Duration { -- const MAX_NANOS_F32: f32 = -- ((u64::MAX as u128 + 1)*(NANOS_PER_SEC as u128)) as f32; -- let nanos = secs * (NANOS_PER_SEC as f32); -- if !nanos.is_finite() { -- panic!("got non-finite value when converting float to duration"); -- } -- if nanos >= MAX_NANOS_F32 { -- panic!("overflow when converting float to duration"); -- } -- if nanos < 0.0 { -- panic!("underflow when converting float to duration"); -- } -- let nanos = nanos as u128; -- Duration { -- secs: (nanos / (NANOS_PER_SEC as u128)) as u64, -- nanos: (nanos % (NANOS_PER_SEC as u128)) as u32, -- } -- } -- -- /// Multiplies `Duration` by `f64`. -- /// -- /// # Panics -- /// This method will panic if result is not finite, negative or overflows `Duration`. -- /// -- /// # Examples -- /// ``` -- /// #![feature(duration_float)] -- /// use std::time::Duration; -- /// -- /// let dur = Duration::new(2, 700_000_000); -- /// assert_eq!(dur.mul_f64(3.14), Duration::new(8, 478_000_000)); -- /// assert_eq!(dur.mul_f64(3.14e5), Duration::new(847_800, 0)); -- /// ``` -- #[unstable(feature = "duration_float", issue = "54361")] -- #[inline] -- pub fn mul_f64(self, rhs: f64) -> Duration { -- Duration::from_secs_f64(rhs * self.as_secs_f64()) -- } -- -- /// Multiplies `Duration` by `f32`. -- /// -- /// # Panics -- /// This method will panic if result is not finite, negative or overflows `Duration`. -- /// -- /// # Examples -- /// ``` -- /// #![feature(duration_float)] -- /// use std::time::Duration; -- /// -- /// let dur = Duration::new(2, 700_000_000); -- /// // note that due to rounding errors result is slightly different -- /// // from 8.478 and 847800.0 -- /// assert_eq!(dur.mul_f32(3.14), Duration::new(8, 478_000_640)); -- /// assert_eq!(dur.mul_f32(3.14e5), Duration::new(847799, 969_120_256)); -- /// ``` -- #[unstable(feature = "duration_float", issue = "54361")] -- #[inline] -- pub fn mul_f32(self, rhs: f32) -> Duration { -- Duration::from_secs_f32(rhs * self.as_secs_f32()) -- } -- -- /// Divide `Duration` by `f64`. -- /// -- /// # Panics -- /// This method will panic if result is not finite, negative or overflows `Duration`. -- /// -- /// # Examples -- /// ``` -- /// #![feature(duration_float)] -- /// use std::time::Duration; -- /// -- /// let dur = Duration::new(2, 700_000_000); -- /// assert_eq!(dur.div_f64(3.14), Duration::new(0, 859_872_611)); -- /// // note that truncation is used, not rounding -- /// assert_eq!(dur.div_f64(3.14e5), Duration::new(0, 8_598)); -- /// ``` -- #[unstable(feature = "duration_float", issue = "54361")] -- #[inline] -- pub fn div_f64(self, rhs: f64) -> Duration { -- Duration::from_secs_f64(self.as_secs_f64() / rhs) -- } -- -- /// Divide `Duration` by `f32`. -- /// -- /// # Panics -- /// This method will panic if result is not finite, negative or overflows `Duration`. -- /// -- /// # Examples -- /// ``` -- /// #![feature(duration_float)] -- /// use std::time::Duration; -- /// -- /// let dur = Duration::new(2, 700_000_000); -- /// // note that due to rounding errors result is slightly -- /// // different from 0.859_872_611 -- /// assert_eq!(dur.div_f32(3.14), Duration::new(0, 859_872_576)); -- /// // note that truncation is used, not rounding -- /// assert_eq!(dur.div_f32(3.14e5), Duration::new(0, 8_598)); -- /// ``` -- #[unstable(feature = "duration_float", issue = "54361")] -- #[inline] -- pub fn div_f32(self, rhs: f32) -> Duration { -- Duration::from_secs_f32(self.as_secs_f32() / rhs) -- } -- -- /// Divide `Duration` by `Duration` and return `f64`. -- /// -- /// # Examples -- /// ``` -- /// #![feature(duration_float)] -- /// use std::time::Duration; -- /// -- /// let dur1 = Duration::new(2, 700_000_000); -- /// let dur2 = Duration::new(5, 400_000_000); -- /// assert_eq!(dur1.div_duration_f64(dur2), 0.5); -- /// ``` -- #[unstable(feature = "duration_float", issue = "54361")] -- #[inline] -- pub fn div_duration_f64(self, rhs: Duration) -> f64 { -- self.as_secs_f64() / rhs.as_secs_f64() -- } -- -- /// Divide `Duration` by `Duration` and return `f32`. -- /// -- /// # Examples -- /// ``` -- /// #![feature(duration_float)] -- /// use std::time::Duration; -- /// -- /// let dur1 = Duration::new(2, 700_000_000); -- /// let dur2 = Duration::new(5, 400_000_000); -- /// assert_eq!(dur1.div_duration_f32(dur2), 0.5); -- /// ``` -- #[unstable(feature = "duration_float", issue = "54361")] -- #[inline] -- pub fn div_duration_f32(self, rhs: Duration) -> f32 { -- self.as_secs_f32() / rhs.as_secs_f32() -- } - } - - #[stable(feature = "duration", since = "1.3.0")] diff --git a/src/libstd/num.rs b/src/libstd/num.rs index 828d572..bc04fb1 100644 --- a/src/libstd/num.rs