316 lines
12 KiB
Diff
316 lines
12 KiB
Diff
From e87977477e8507a5749e64ea49ee503e706d7178 Mon Sep 17 00:00:00 2001
|
|
From: bjorn3 <bjorn3@users.noreply.github.com>
|
|
Date: Fri, 1 Mar 2019 18:36:21 +0100
|
|
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(-)
|
|
|
|
diff --git a/src/libcore/num/mod.rs b/src/libcore/num/mod.rs
|
|
index 6b657b1..5add3f3 100644
|
|
--- a/src/libcore/num/mod.rs
|
|
+++ b/src/libcore/num/mod.rs
|
|
@@ -127,8 +127,8 @@ macro_rules! from_str_radix_nzint_impl {
|
|
)*}
|
|
}
|
|
|
|
-from_str_radix_nzint_impl! { NonZeroU8 NonZeroU16 NonZeroU32 NonZeroU64 NonZeroU128 NonZeroUsize
|
|
- NonZeroI8 NonZeroI16 NonZeroI32 NonZeroI64 NonZeroI128 NonZeroIsize }
|
|
+from_str_radix_nzint_impl! { NonZeroU8 NonZeroU16 NonZeroU32 NonZeroU64 NonZeroUsize
|
|
+ NonZeroI8 NonZeroI16 NonZeroI32 NonZeroI64 NonZeroIsize }
|
|
|
|
/// Provides intentionally-wrapped arithmetic on `T`.
|
|
///
|
|
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 }
|
|
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
|
|
+++ 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};
|
|
#[stable(feature = "signed_nonzero", since = "1.34.0")]
|
|
-pub use core::num::{NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI128, NonZeroIsize};
|
|
+pub use core::num::{NonZeroI8, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroIsize};
|
|
|
|
#[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)
|