Skip to content

Commit 8506784

Browse files
committed
Reduce patching of libcore a bit
These parts are no longer necessary as of #627
1 parent a302f88 commit 8506784

File tree

1 file changed

+0
-203
lines changed

1 file changed

+0
-203
lines changed

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

-203
Original file line numberDiff line numberDiff line change
@@ -68,209 +68,6 @@ index d0ee5fa..d02c454 100644
6868
#[cfg(target_pointer_width = "16")]
6969
macro_rules! ptr_width {
7070
() => { 2 }
71-
diff --git a/src/libcore/time.rs b/src/libcore/time.rs
72-
index ae6d807..4414e07 100644
73-
--- a/src/libcore/time.rs
74-
+++ b/src/libcore/time.rs
75-
@@ -534,198 +534,6 @@ impl Duration {
76-
pub const fn as_secs_f32(&self) -> f32 {
77-
(self.secs as f32) + (self.nanos as f32) / (NANOS_PER_SEC as f32)
78-
}
79-
-
80-
- /// Creates a new `Duration` from the specified number of seconds represented
81-
- /// as `f64`.
82-
- ///
83-
- /// # Panics
84-
- /// This constructor will panic if `secs` is not finite, negative or overflows `Duration`.
85-
- ///
86-
- /// # Examples
87-
- /// ```
88-
- /// #![feature(duration_float)]
89-
- /// use std::time::Duration;
90-
- ///
91-
- /// let dur = Duration::from_secs_f64(2.7);
92-
- /// assert_eq!(dur, Duration::new(2, 700_000_000));
93-
- /// ```
94-
- #[unstable(feature = "duration_float", issue = "54361")]
95-
- #[inline]
96-
- pub fn from_secs_f64(secs: f64) -> Duration {
97-
- const MAX_NANOS_F64: f64 =
98-
- ((u64::MAX as u128 + 1)*(NANOS_PER_SEC as u128)) as f64;
99-
- let nanos = secs * (NANOS_PER_SEC as f64);
100-
- if !nanos.is_finite() {
101-
- panic!("got non-finite value when converting float to duration");
102-
- }
103-
- if nanos >= MAX_NANOS_F64 {
104-
- panic!("overflow when converting float to duration");
105-
- }
106-
- if nanos < 0.0 {
107-
- panic!("underflow when converting float to duration");
108-
- }
109-
- let nanos = nanos as u128;
110-
- Duration {
111-
- secs: (nanos / (NANOS_PER_SEC as u128)) as u64,
112-
- nanos: (nanos % (NANOS_PER_SEC as u128)) as u32,
113-
- }
114-
- }
115-
-
116-
- /// Creates a new `Duration` from the specified number of seconds represented
117-
- /// as `f32`.
118-
- ///
119-
- /// # Panics
120-
- /// This constructor will panic if `secs` is not finite, negative or overflows `Duration`.
121-
- ///
122-
- /// # Examples
123-
- /// ```
124-
- /// #![feature(duration_float)]
125-
- /// use std::time::Duration;
126-
- ///
127-
- /// let dur = Duration::from_secs_f32(2.7);
128-
- /// assert_eq!(dur, Duration::new(2, 700_000_000));
129-
- /// ```
130-
- #[unstable(feature = "duration_float", issue = "54361")]
131-
- #[inline]
132-
- pub fn from_secs_f32(secs: f32) -> Duration {
133-
- const MAX_NANOS_F32: f32 =
134-
- ((u64::MAX as u128 + 1)*(NANOS_PER_SEC as u128)) as f32;
135-
- let nanos = secs * (NANOS_PER_SEC as f32);
136-
- if !nanos.is_finite() {
137-
- panic!("got non-finite value when converting float to duration");
138-
- }
139-
- if nanos >= MAX_NANOS_F32 {
140-
- panic!("overflow when converting float to duration");
141-
- }
142-
- if nanos < 0.0 {
143-
- panic!("underflow when converting float to duration");
144-
- }
145-
- let nanos = nanos as u128;
146-
- Duration {
147-
- secs: (nanos / (NANOS_PER_SEC as u128)) as u64,
148-
- nanos: (nanos % (NANOS_PER_SEC as u128)) as u32,
149-
- }
150-
- }
151-
-
152-
- /// Multiplies `Duration` by `f64`.
153-
- ///
154-
- /// # Panics
155-
- /// This method will panic if result is not finite, negative or overflows `Duration`.
156-
- ///
157-
- /// # Examples
158-
- /// ```
159-
- /// #![feature(duration_float)]
160-
- /// use std::time::Duration;
161-
- ///
162-
- /// let dur = Duration::new(2, 700_000_000);
163-
- /// assert_eq!(dur.mul_f64(3.14), Duration::new(8, 478_000_000));
164-
- /// assert_eq!(dur.mul_f64(3.14e5), Duration::new(847_800, 0));
165-
- /// ```
166-
- #[unstable(feature = "duration_float", issue = "54361")]
167-
- #[inline]
168-
- pub fn mul_f64(self, rhs: f64) -> Duration {
169-
- Duration::from_secs_f64(rhs * self.as_secs_f64())
170-
- }
171-
-
172-
- /// Multiplies `Duration` by `f32`.
173-
- ///
174-
- /// # Panics
175-
- /// This method will panic if result is not finite, negative or overflows `Duration`.
176-
- ///
177-
- /// # Examples
178-
- /// ```
179-
- /// #![feature(duration_float)]
180-
- /// use std::time::Duration;
181-
- ///
182-
- /// let dur = Duration::new(2, 700_000_000);
183-
- /// // note that due to rounding errors result is slightly different
184-
- /// // from 8.478 and 847800.0
185-
- /// assert_eq!(dur.mul_f32(3.14), Duration::new(8, 478_000_640));
186-
- /// assert_eq!(dur.mul_f32(3.14e5), Duration::new(847799, 969_120_256));
187-
- /// ```
188-
- #[unstable(feature = "duration_float", issue = "54361")]
189-
- #[inline]
190-
- pub fn mul_f32(self, rhs: f32) -> Duration {
191-
- Duration::from_secs_f32(rhs * self.as_secs_f32())
192-
- }
193-
-
194-
- /// Divide `Duration` by `f64`.
195-
- ///
196-
- /// # Panics
197-
- /// This method will panic if result is not finite, negative or overflows `Duration`.
198-
- ///
199-
- /// # Examples
200-
- /// ```
201-
- /// #![feature(duration_float)]
202-
- /// use std::time::Duration;
203-
- ///
204-
- /// let dur = Duration::new(2, 700_000_000);
205-
- /// assert_eq!(dur.div_f64(3.14), Duration::new(0, 859_872_611));
206-
- /// // note that truncation is used, not rounding
207-
- /// assert_eq!(dur.div_f64(3.14e5), Duration::new(0, 8_598));
208-
- /// ```
209-
- #[unstable(feature = "duration_float", issue = "54361")]
210-
- #[inline]
211-
- pub fn div_f64(self, rhs: f64) -> Duration {
212-
- Duration::from_secs_f64(self.as_secs_f64() / rhs)
213-
- }
214-
-
215-
- /// Divide `Duration` by `f32`.
216-
- ///
217-
- /// # Panics
218-
- /// This method will panic if result is not finite, negative or overflows `Duration`.
219-
- ///
220-
- /// # Examples
221-
- /// ```
222-
- /// #![feature(duration_float)]
223-
- /// use std::time::Duration;
224-
- ///
225-
- /// let dur = Duration::new(2, 700_000_000);
226-
- /// // note that due to rounding errors result is slightly
227-
- /// // different from 0.859_872_611
228-
- /// assert_eq!(dur.div_f32(3.14), Duration::new(0, 859_872_576));
229-
- /// // note that truncation is used, not rounding
230-
- /// assert_eq!(dur.div_f32(3.14e5), Duration::new(0, 8_598));
231-
- /// ```
232-
- #[unstable(feature = "duration_float", issue = "54361")]
233-
- #[inline]
234-
- pub fn div_f32(self, rhs: f32) -> Duration {
235-
- Duration::from_secs_f32(self.as_secs_f32() / rhs)
236-
- }
237-
-
238-
- /// Divide `Duration` by `Duration` and return `f64`.
239-
- ///
240-
- /// # Examples
241-
- /// ```
242-
- /// #![feature(duration_float)]
243-
- /// use std::time::Duration;
244-
- ///
245-
- /// let dur1 = Duration::new(2, 700_000_000);
246-
- /// let dur2 = Duration::new(5, 400_000_000);
247-
- /// assert_eq!(dur1.div_duration_f64(dur2), 0.5);
248-
- /// ```
249-
- #[unstable(feature = "duration_float", issue = "54361")]
250-
- #[inline]
251-
- pub fn div_duration_f64(self, rhs: Duration) -> f64 {
252-
- self.as_secs_f64() / rhs.as_secs_f64()
253-
- }
254-
-
255-
- /// Divide `Duration` by `Duration` and return `f32`.
256-
- ///
257-
- /// # Examples
258-
- /// ```
259-
- /// #![feature(duration_float)]
260-
- /// use std::time::Duration;
261-
- ///
262-
- /// let dur1 = Duration::new(2, 700_000_000);
263-
- /// let dur2 = Duration::new(5, 400_000_000);
264-
- /// assert_eq!(dur1.div_duration_f32(dur2), 0.5);
265-
- /// ```
266-
- #[unstable(feature = "duration_float", issue = "54361")]
267-
- #[inline]
268-
- pub fn div_duration_f32(self, rhs: Duration) -> f32 {
269-
- self.as_secs_f32() / rhs.as_secs_f32()
270-
- }
271-
}
272-
273-
#[stable(feature = "duration", since = "1.3.0")]
27471
diff --git a/src/libstd/num.rs b/src/libstd/num.rs
27572
index 828d572..bc04fb1 100644
27673
--- a/src/libstd/num.rs

0 commit comments

Comments
 (0)