rust/patches/0002-Disable-u128-and-i128-in-libcore.patch

180 lines
6.6 KiB
Diff
Raw Normal View History

From e87977477e8507a5749e64ea49ee503e706d7178 Mon Sep 17 00:00:00 2001
2018-07-18 05:25:01 -05:00
From: bjorn3 <bjorn3@users.noreply.github.com>
Date: Fri, 1 Mar 2019 18:36:21 +0100
2018-07-18 05:25:01 -05:00
Subject: [PATCH] Disable u128 and i128 in libcore
---
src/libcore/sync/atomic.rs | 32 --------
src/libcore/time.rs | 123 -------------------------------
src/libstd/num.rs | 2 +-
src/libstd/panic.rs | 6 --
20 files changed, 63 insertions(+), 363 deletions(-)
2018-07-18 05:25:01 -05:00
diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs
index d0ee5fa..d02c454 100644
--- a/src/libcore/sync/atomic.rs
+++ b/src/libcore/sync/atomic.rs
@@ -2012,38 +2012,6 @@ atomic_int! {
"AtomicU64::new(0)",
u64 AtomicU64 ATOMIC_U64_INIT
}
-#[cfg(target_has_atomic = "128")]
-atomic_int! {
- unstable(feature = "integer_atomics", issue = "32976"),
- unstable(feature = "integer_atomics", issue = "32976"),
- unstable(feature = "integer_atomics", issue = "32976"),
- unstable(feature = "integer_atomics", issue = "32976"),
- unstable(feature = "integer_atomics", issue = "32976"),
- unstable(feature = "integer_atomics", issue = "32976"),
- unstable(feature = "integer_atomics", issue = "32976"),
- "i128", "../../../std/primitive.i128.html",
- "#![feature(integer_atomics)]\n\n",
- atomic_min, atomic_max,
- 16,
- "AtomicI128::new(0)",
- i128 AtomicI128 ATOMIC_I128_INIT
-}
-#[cfg(target_has_atomic = "128")]
-atomic_int! {
- unstable(feature = "integer_atomics", issue = "32976"),
- unstable(feature = "integer_atomics", issue = "32976"),
- unstable(feature = "integer_atomics", issue = "32976"),
- unstable(feature = "integer_atomics", issue = "32976"),
- unstable(feature = "integer_atomics", issue = "32976"),
- unstable(feature = "integer_atomics", issue = "32976"),
- unstable(feature = "integer_atomics", issue = "32976"),
- "u128", "../../../std/primitive.u128.html",
- "#![feature(integer_atomics)]\n\n",
- atomic_umin, atomic_umax,
- 16,
- "AtomicU128::new(0)",
- u128 AtomicU128 ATOMIC_U128_INIT
-}
#[cfg(target_pointer_width = "16")]
macro_rules! ptr_width {
() => { 2 }
2018-10-06 06:04:29 -05:00
diff --git a/src/libcore/time.rs b/src/libcore/time.rs
index 91161ca..759497f 100644
2018-10-06 06:04:29 -05:00
--- a/src/libcore/time.rs
+++ b/src/libcore/time.rs
@@ -518,80 +469,6 @@ impl Duration {
2018-10-06 06:04:29 -05:00
(self.secs as f64) + (self.nanos as f64) / (NANOS_PER_SEC as f64)
}
2018-10-06 06:04:29 -05:00
- /// Creates a new `Duration` from the specified number of seconds.
- ///
- /// # 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_float_secs(2.7);
- /// assert_eq!(dur, Duration::new(2, 700_000_000));
- /// ```
- #[unstable(feature = "duration_float", issue = "54361")]
- #[inline]
- pub fn from_float_secs(secs: f64) -> Duration {
- 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,
- }
- }
-
- /// Multiplies `Duration` by `f64`.
2018-10-06 06:04:29 -05:00
- ///
- /// # 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_float_secs(rhs * self.as_float_secs())
- }
-
- /// 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_float_secs(self.as_float_secs() / rhs)
- }
-
/// Divide `Duration` by `Duration` and return `f64`.
///
/// # Examples
diff --git a/src/libstd/num.rs b/src/libstd/num.rs
index 828d572..bc04fb1 100644
--- a/src/libstd/num.rs
+++ b/src/libstd/num.rs
@@ -12,7 +12,7 @@ pub use core::num::{FpCategory, ParseIntError, ParseFloatError, TryFromIntError}
pub use core::num::Wrapping;
#[stable(feature = "nonzero", since = "1.28.0")]
-pub use core::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU128, NonZeroUsize};
+pub use core::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64, NonZeroUsize};
#[cfg(test)] use crate::fmt;
#[cfg(test)] use crate::ops::{Add, Sub, Mul, Div, Rem};
diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs
index 6a16414..f027102 100644
--- a/src/libstd/panic.rs
+++ b/src/libstd/panic.rs
@@ -254,9 +254,6 @@ impl RefUnwindSafe for atomic::AtomicI32 {}
#[cfg(target_has_atomic = "64")]
#[unstable(feature = "integer_atomics", issue = "32976")]
impl RefUnwindSafe for atomic::AtomicI64 {}
-#[cfg(target_has_atomic = "128")]
-#[unstable(feature = "integer_atomics", issue = "32976")]
-impl RefUnwindSafe for atomic::AtomicI128 {}
#[cfg(target_has_atomic = "ptr")]
#[stable(feature = "unwind_safe_atomic_refs", since = "1.14.0")]
@@ -273,9 +270,6 @@ impl RefUnwindSafe for atomic::AtomicU32 {}
#[cfg(target_has_atomic = "64")]
#[unstable(feature = "integer_atomics", issue = "32976")]
impl RefUnwindSafe for atomic::AtomicU64 {}
-#[cfg(target_has_atomic = "128")]
-#[unstable(feature = "integer_atomics", issue = "32976")]
-impl RefUnwindSafe for atomic::AtomicU128 {}
#[cfg(target_has_atomic = "8")]
#[stable(feature = "unwind_safe_atomic_refs", since = "1.14.0")]
--
2.17.2 (Apple Git-113)