Skip to content

Commit f01cc88

Browse files
committed
---
yaml --- r: 96059 b: refs/heads/dist-snap c: f1a67bd h: refs/heads/master i: 96057: 3ab06a2 96055: 8c519ff v: v3
1 parent d0cda56 commit f01cc88

File tree

11 files changed

+145
-211
lines changed

11 files changed

+145
-211
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 49ee49296b65f3d807142f3326bee71dd7e13290
9+
refs/heads/dist-snap: f1a67bd4c0b3a8497f561144485ad757842a0078
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/librustc/back/link.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -955,8 +955,9 @@ pub fn link_binary(sess: Session,
955955
sess.abort_if_errors();
956956
}
957957

958-
// Clean up on Darwin
959-
if sess.targ_cfg.os == abi::OsMacos {
958+
// On OSX, debuggers needs this utility to get run to do some munging of the
959+
// symbols
960+
if sess.targ_cfg.os == abi::OsMacos && sess.opts.debuginfo {
960961
// FIXME (#9639): This needs to handle non-utf8 paths
961962
run::process_status("dsymutil", [output.as_str().unwrap().to_owned()]);
962963
}

branches/dist-snap/src/libstd/num/mod.rs

Lines changed: 131 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,26 +136,87 @@ pub trait Integer: Num
136136
/// Calculates the Lowest Common Multiple (LCM) of the number and `other`.
137137
#[inline(always)] pub fn lcm<T: Integer>(x: T, y: T) -> T { x.lcm(&y) }
138138

139+
/// A collection of rounding operations.
139140
pub trait Round {
141+
/// Return the largest integer less than or equal to a number.
142+
///
143+
/// # Example
144+
///
145+
/// ```rust
146+
/// assert_approx_eq!(1.3f32.floor(), 1.0);
147+
/// assert_approx_eq!((-1.3f32).floor(), -2.0);
148+
/// ```
140149
fn floor(&self) -> Self;
150+
151+
/// Return the smallest integer greater than or equal to a number.
152+
///
153+
/// # Example
154+
///
155+
/// ```rust
156+
/// assert_approx_eq!(1.3f32.ceil(), 2.0);
157+
/// assert_approx_eq!((-1.3f32).ceil(), -1.0);
158+
/// ```
141159
fn ceil(&self) -> Self;
160+
161+
/// Return the nearest integer to a number. Round half-way cases away from
162+
/// `0.0`.
163+
///
164+
/// # Example
165+
///
166+
/// ```rust
167+
/// assert_approx_eq!(1.3f32.round(), 1.0);
168+
/// assert_approx_eq!((-1.3f32).round(), -1.0);
169+
/// assert_approx_eq!(1.5f32.round(), 2.0);
170+
/// assert_approx_eq!((-1.5f32).round(), -2.0);
171+
/// ```
142172
fn round(&self) -> Self;
173+
174+
/// Return the integer part of a number.
175+
///
176+
/// # Example
177+
///
178+
/// ```rust
179+
/// assert_approx_eq!(1.3f32.round(), 1.0);
180+
/// assert_approx_eq!((-1.3f32).round(), -1.0);
181+
/// assert_approx_eq!(1.5f32.round(), 1.0);
182+
/// assert_approx_eq!((-1.5f32).round(), -1.0);
183+
/// ```
143184
fn trunc(&self) -> Self;
185+
186+
/// Return the fractional part of a number.
187+
///
188+
/// # Example
189+
///
190+
/// ```rust
191+
/// assert_approx_eq!(1.3f32.round(), 0.3);
192+
/// assert_approx_eq!((-1.3f32).round(), -0.3);
193+
/// assert_approx_eq!(1.5f32.round(), 0.5);
194+
/// assert_approx_eq!((-1.5f32).round(), -0.5);
195+
/// ```
144196
fn fract(&self) -> Self;
145197
}
146198

199+
/// Trait for common fractional operations.
147200
pub trait Fractional: Num
148201
+ Orderable
149202
+ Round
150203
+ Div<Self,Self> {
204+
/// Take the reciprocal (inverse) of a number, `1/x`.
151205
fn recip(&self) -> Self;
152206
}
153207

208+
/// A collection of algebraic operations.
154209
pub trait Algebraic {
210+
/// Raise a number to a power.
155211
fn pow(&self, n: &Self) -> Self;
212+
/// Take the squre root of a number.
156213
fn sqrt(&self) -> Self;
214+
/// Take the reciprocal (inverse) square root of a number, `1/sqrt(x)`.
157215
fn rsqrt(&self) -> Self;
216+
/// Take the cubic root of a number.
158217
fn cbrt(&self) -> Self;
218+
/// Calculate the length of the hypotenuse of a right-angle triangle given
219+
/// legs of length `x` and `y`.
159220
fn hypot(&self, other: &Self) -> Self;
160221
}
161222

@@ -178,16 +239,42 @@ pub trait Algebraic {
178239
/// `y`.
179240
#[inline(always)] pub fn hypot<T: Algebraic>(x: T, y: T) -> T { x.hypot(&y) }
180241

242+
/// A trait for trigonometric functions.
181243
pub trait Trigonometric {
244+
/// Computes the sine of a number (in radians).
182245
fn sin(&self) -> Self;
246+
/// Computes the cosine of a number (in radians).
183247
fn cos(&self) -> Self;
248+
/// Computes the tangent of a number (in radians).
184249
fn tan(&self) -> Self;
185250

251+
/// Computes the arcsine of a number. Return value is in radians in
252+
/// the range [-pi/2, pi/2] or NaN if the number is outside the range
253+
/// [-1, 1].
186254
fn asin(&self) -> Self;
255+
/// Computes the arccosine of a number. Return value is in radians in
256+
/// the range [0, pi] or NaN if the number is outside the range
257+
/// [-1, 1].
187258
fn acos(&self) -> Self;
259+
/// Computes the arctangent of a number. Return value is in radians in the
260+
/// range [-pi/2, pi/2];
188261
fn atan(&self) -> Self;
189262

263+
/// Computes the four quadrant arctangent of a number, `y`, and another
264+
/// number `x`. Return value is in radians in the range [-pi, pi];
265+
///
266+
/// # Example
267+
///
268+
/// ```rust
269+
/// let y = 3f32.sqrt();
270+
/// let x = 1f32;
271+
/// assert_approx_eq!(y.atan2(&x), f32::consts::PI / 3f32);
272+
/// assert_approx_eq!((-y).atan2(&(-x)), - 2f32 * f32::consts::PI / 3f32);
273+
/// ```
190274
fn atan2(&self, other: &Self) -> Self;
275+
276+
/// Simultaneously computes the sine and cosine of the number, `x`. Returns
277+
/// `(sin(x), cos(x))`.
191278
fn sin_cos(&self) -> (Self, Self);
192279
}
193280

@@ -210,13 +297,20 @@ pub trait Trigonometric {
210297
/// Simultaneously computes the sine and cosine of the number.
211298
#[inline(always)] pub fn sin_cos<T: Trigonometric>(value: T) -> (T, T) { value.sin_cos() }
212299

300+
/// A trait exponential functions.
213301
pub trait Exponential {
302+
/// Returns `e^(self)`, (the exponential function).
214303
fn exp(&self) -> Self;
304+
/// Returns 2 raised to the power of the number, `2^(self)`.
215305
fn exp2(&self) -> Self;
216306

307+
/// Returns the natural logarithm of the number.
217308
fn ln(&self) -> Self;
309+
/// Returns the logarithm of the number with respect to an arbitrary base.
218310
fn log(&self, base: &Self) -> Self;
311+
/// Returns the base 2 logarithm of the number.
219312
fn log2(&self) -> Self;
313+
/// Returns the base 10 logarithm of the number.
220314
fn log10(&self) -> Self;
221315
}
222316

@@ -234,19 +328,26 @@ pub trait Exponential {
234328
/// Returns the base 10 logarithm of the number.
235329
#[inline(always)] pub fn log10<T: Exponential>(value: T) -> T { value.log10() }
236330

331+
/// A trait hyperbolic functions.
237332
pub trait Hyperbolic: Exponential {
333+
/// Hyperbolic sine function.
238334
fn sinh(&self) -> Self;
335+
/// Hyperbolic cosine function.
239336
fn cosh(&self) -> Self;
337+
/// Hyperbolic tangent function.
240338
fn tanh(&self) -> Self;
241339

340+
/// Inverse hyperbolic sine function.
242341
fn asinh(&self) -> Self;
342+
/// Inverse hyperbolic cosine function.
243343
fn acosh(&self) -> Self;
344+
/// Inverse hyperbolic tangent function.
244345
fn atanh(&self) -> Self;
245346
}
246347

247-
/// Hyperbolic cosine function.
248-
#[inline(always)] pub fn sinh<T: Hyperbolic>(value: T) -> T { value.sinh() }
249348
/// Hyperbolic sine function.
349+
#[inline(always)] pub fn sinh<T: Hyperbolic>(value: T) -> T { value.sinh() }
350+
/// Hyperbolic cosine function.
250351
#[inline(always)] pub fn cosh<T: Hyperbolic>(value: T) -> T { value.cosh() }
251352
/// Hyperbolic tangent function.
252353
#[inline(always)] pub fn tanh<T: Hyperbolic>(value: T) -> T { value.tanh() }
@@ -285,7 +386,10 @@ pub trait Real: Signed
285386
fn ln_10() -> Self;
286387

287388
// Angular conversions
389+
390+
/// Convert radians to degrees.
288391
fn to_degrees(&self) -> Self;
392+
/// Convert degrees to radians.
289393
fn to_radians(&self) -> Self;
290394
}
291395

@@ -315,9 +419,34 @@ pub trait Bitwise: Not<Self>
315419
+ Shl<Self,Self>
316420
+ Shr<Self,Self> {}
317421

422+
/// A trait for common counting operations on bits.
318423
pub trait BitCount {
424+
/// Returns the number of bits set in the number.
425+
///
426+
/// # Example
427+
///
428+
/// ```rust
429+
/// let n = 0b0101000u16;
430+
/// assert_eq!(n.population_count(), 2);
431+
/// ```
319432
fn population_count(&self) -> Self;
433+
/// Returns the number of leading zeros in the number.
434+
///
435+
/// # Example
436+
///
437+
/// ```rust
438+
/// let n = 0b0101000u16;
439+
/// assert_eq!(n.leading_zeros(), 10);
440+
/// ```
320441
fn leading_zeros(&self) -> Self;
442+
/// Returns the number of trailing zeros in the number.
443+
///
444+
/// # Example
445+
///
446+
/// ```rust
447+
/// let n = 0b0101000u16;
448+
/// assert_eq!(n.trailing_zeros(), 3);
449+
/// ```
321450
fn trailing_zeros(&self) -> Self;
322451
}
323452

branches/dist-snap/src/rt/rust_builtin.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
/* Foreign builtins. */
1212

13-
#include "rust_util.h"
1413
#include "sync/lock_and_signal.h"
1514
#include "vg/valgrind.h"
1615

@@ -234,6 +233,16 @@ precise_time_ns(uint64_t *ns) {
234233
#endif
235234
}
236235

236+
struct
237+
rust_vec
238+
{
239+
size_t fill; // in bytes; if zero, heapified
240+
size_t alloc; // in bytes
241+
uint8_t data[0];
242+
};
243+
244+
typedef rust_vec rust_str;
245+
237246
struct rust_tm {
238247
int32_t tm_sec;
239248
int32_t tm_min;

branches/dist-snap/src/rt/rust_test_helpers.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
// Helper functions used only in tests
1212

13-
#include "rust_util.h"
1413
#include "sync/lock_and_signal.h"
1514

1615
// These functions are used in the unit tests for C ABI calls.

branches/dist-snap/src/rt/rust_type.h

Lines changed: 0 additions & 81 deletions
This file was deleted.

branches/dist-snap/src/rt/rust_upcall.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818

1919
#include "rust_globals.h"
20-
#include "rust_util.h"
2120

2221
//Unwinding ABI declarations.
2322
typedef int _Unwind_Reason_Code;

0 commit comments

Comments
 (0)