Skip to content

Commit ba39486

Browse files
committed
---
yaml --- r: 64886 b: refs/heads/snap-stage3 c: 8f835d4 h: refs/heads/master v: v3
1 parent 99f7f76 commit ba39486

File tree

23 files changed

+112
-259
lines changed

23 files changed

+112
-259
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 2d28d645422c1617be58c8ca7ad9a457264ca850
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 6534b4d4ce87940954b017bd27dc4e5fa7e59703
4+
refs/heads/snap-stage3: 8f835d42d7f7090ab6408a9aa6316a0f8f21f3f3
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/libextra/sync.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ mod tests {
890890
fn test_sem_runtime_friendly_blocking() {
891891
// Force the runtime to schedule two threads on the same sched_loop.
892892
// When one blocks, it should schedule the other one.
893-
do task::spawn_sched(task::ManualThreads(1)) {
893+
do task::spawn_sched(task::SingleThreaded) {
894894
let s = ~Semaphore::new(1);
895895
let s2 = ~s.clone();
896896
let (p,c) = comm::stream();

branches/snap-stage3/src/libextra/unicode.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub mod icu {
1717
pub type UChar32 = char;
1818

1919
pub static TRUE : u8 = 1u8;
20-
pub static FALSE : u8 = 0u8;
20+
pub static FALSE : u8 = 1u8;
2121

2222
pub static UCHAR_ALPHABETIC : UProperty = 0;
2323
pub static UCHAR_BINARY_START : UProperty = 0; // = UCHAR_ALPHABETIC

branches/snap-stage3/src/libstd/num/num.rs

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
//! Numeric traits and functions for generic mathematics.
12-
//!
13-
//! These are implemented for the primitive numeric types in `std::{u8, u16,
14-
//! u32, u64, uint, i8, i16, i32, i64, int, f32, f64, float}`.
11+
//! An interface for numeric types
1512
1613
#[allow(missing_doc)];
1714

@@ -22,7 +19,9 @@ use option::Option;
2219

2320
pub mod strconv;
2421

22+
///
2523
/// The base trait for numeric types
24+
///
2625
pub trait Num: Eq + Zero + One
2726
+ Neg<Self>
2827
+ Add<Self,Self>
@@ -46,23 +45,18 @@ pub trait Orderable: Ord {
4645
fn clamp(&self, mn: &Self, mx: &Self) -> Self;
4746
}
4847

49-
#[inline(always)] pub fn min<T: Orderable>(x: T, y: T) -> T { x.min(&y) }
50-
#[inline(always)] pub fn max<T: Orderable>(x: T, y: T) -> T { x.max(&y) }
51-
#[inline(always)] pub fn clamp<T: Orderable>(value: T, mn: T, mx: T) -> T { value.clamp(&mn, &mx) }
48+
#[inline(always)] pub fn min<T: Orderable>(a: T, b: T) -> T { a.min(&b) }
49+
#[inline(always)] pub fn max<T: Orderable>(a: T, b: T) -> T { a.max(&b) }
5250

5351
pub trait Zero {
5452
fn zero() -> Self; // FIXME (#5527): This should be an associated constant
5553
fn is_zero(&self) -> bool;
5654
}
5755

58-
#[inline(always)] pub fn zero<T: Zero>() -> T { Zero::zero() }
59-
6056
pub trait One {
6157
fn one() -> Self; // FIXME (#5527): This should be an associated constant
6258
}
6359

64-
#[inline(always)] pub fn one<T: One>() -> T { One::one() }
65-
6660
pub trait Signed: Num
6761
+ Neg<Self> {
6862
fn abs(&self) -> Self;
@@ -74,7 +68,6 @@ pub trait Signed: Num
7468
}
7569

7670
#[inline(always)] pub fn abs<T: Signed>(value: T) -> T { value.abs() }
77-
#[inline(always)] pub fn abs_sub<T: Signed>(x: T, y: T) -> T { x.abs_sub(&y) }
7871
#[inline(always)] pub fn signum<T: Signed>(value: T) -> T { value.signum() }
7972

8073
pub trait Unsigned: Num {}
@@ -97,9 +90,6 @@ pub trait Integer: Num
9790
fn is_odd(&self) -> bool;
9891
}
9992

100-
#[inline(always)] pub fn gcd<T: Integer>(x: T, y: T) -> T { x.gcd(&y) }
101-
#[inline(always)] pub fn lcm<T: Integer>(x: T, y: T) -> T { x.lcm(&y) }
102-
10393
pub trait Round {
10494
fn floor(&self) -> Self;
10595
fn ceil(&self) -> Self;
@@ -123,21 +113,15 @@ pub trait Algebraic {
123113
fn hypot(&self, other: &Self) -> Self;
124114
}
125115

126-
#[inline(always)] pub fn pow<T: Algebraic>(value: T, n: T) -> T { value.pow(&n) }
127116
#[inline(always)] pub fn sqrt<T: Algebraic>(value: T) -> T { value.sqrt() }
128-
#[inline(always)] pub fn rsqrt<T: Algebraic>(value: T) -> T { value.rsqrt() }
129-
#[inline(always)] pub fn cbrt<T: Algebraic>(value: T) -> T { value.cbrt() }
130-
#[inline(always)] pub fn hypot<T: Algebraic>(x: T, y: T) -> T { x.hypot(&y) }
131117

132118
pub trait Trigonometric {
133119
fn sin(&self) -> Self;
134120
fn cos(&self) -> Self;
135121
fn tan(&self) -> Self;
136-
137122
fn asin(&self) -> Self;
138123
fn acos(&self) -> Self;
139124
fn atan(&self) -> Self;
140-
141125
fn atan2(&self, other: &Self) -> Self;
142126
fn sin_cos(&self) -> (Self, Self);
143127
}
@@ -151,12 +135,10 @@ pub trait Trigonometric {
151135
#[inline(always)] pub fn atan<T: Trigonometric>(value: T) -> T { value.atan() }
152136

153137
#[inline(always)] pub fn atan2<T: Trigonometric>(x: T, y: T) -> T { x.atan2(&y) }
154-
#[inline(always)] pub fn sin_cos<T: Trigonometric>(value: T) -> (T, T) { value.sin_cos() }
155138

156139
pub trait Exponential {
157140
fn exp(&self) -> Self;
158141
fn exp2(&self) -> Self;
159-
160142
fn ln(&self) -> Self;
161143
fn log(&self, base: &Self) -> Self;
162144
fn log2(&self) -> Self;
@@ -175,7 +157,6 @@ pub trait Hyperbolic: Exponential {
175157
fn sinh(&self) -> Self;
176158
fn cosh(&self) -> Self;
177159
fn tanh(&self) -> Self;
178-
179160
fn asinh(&self) -> Self;
180161
fn acosh(&self) -> Self;
181162
fn atanh(&self) -> Self;
@@ -189,7 +170,9 @@ pub trait Hyperbolic: Exponential {
189170
#[inline(always)] pub fn acosh<T: Hyperbolic>(value: T) -> T { value.acosh() }
190171
#[inline(always)] pub fn atanh<T: Hyperbolic>(value: T) -> T { value.atanh() }
191172

173+
///
192174
/// Defines constants and methods common to real numbers
175+
///
193176
pub trait Real: Signed
194177
+ Fractional
195178
+ Algebraic
@@ -220,7 +203,9 @@ pub trait Real: Signed
220203
fn to_radians(&self) -> Self;
221204
}
222205

206+
///
223207
/// Methods that are harder to implement and not commonly used.
208+
///
224209
pub trait RealExt: Real {
225210
// FIXME (#5527): usages of `int` should be replaced with an associated
226211
// integer type once these are implemented
@@ -238,7 +223,9 @@ pub trait RealExt: Real {
238223
fn yn(&self, n: int) -> Self;
239224
}
240225

226+
///
241227
/// Collects the bitwise operators under one trait.
228+
///
242229
pub trait Bitwise: Not<Self>
243230
+ BitAnd<Self,Self>
244231
+ BitOr<Self,Self>
@@ -258,9 +245,11 @@ pub trait Bounded {
258245
fn max_value() -> Self;
259246
}
260247

248+
///
261249
/// Specifies the available operations common to all of Rust's core numeric primitives.
262250
/// These may not always make sense from a purely mathematical point of view, but
263251
/// may be useful for systems programming.
252+
///
264253
pub trait Primitive: Num
265254
+ NumCast
266255
+ Bounded
@@ -275,13 +264,17 @@ pub trait Primitive: Num
275264
fn bytes() -> uint;
276265
}
277266

267+
///
278268
/// A collection of traits relevant to primitive signed and unsigned integers
269+
///
279270
pub trait Int: Integer
280271
+ Primitive
281272
+ Bitwise
282273
+ BitCount {}
283274

275+
///
284276
/// Used for representing the classification of floating point numbers
277+
///
285278
#[deriving(Eq)]
286279
pub enum FPCategory {
287280
/// "Not a Number", often obtained by dividing by zero
@@ -296,7 +289,9 @@ pub enum FPCategory {
296289
FPNormal,
297290
}
298291

292+
///
299293
/// Primitive floating point numbers
294+
///
300295
pub trait Float: Real
301296
+ Signed
302297
+ Primitive
@@ -330,10 +325,7 @@ pub trait Float: Real
330325
fn next_after(&self, other: Self) -> Self;
331326
}
332327

333-
#[inline(always)] pub fn exp_m1<T: Float>(value: T) -> T { value.exp_m1() }
334-
#[inline(always)] pub fn ln_1p<T: Float>(value: T) -> T { value.ln_1p() }
335-
#[inline(always)] pub fn mul_add<T: Float>(a: T, b: T, c: T) -> T { a.mul_add(b, c) }
336-
328+
///
337329
/// Cast from one machine scalar to another
338330
///
339331
/// # Example
@@ -348,7 +340,9 @@ pub fn cast<T:NumCast,U:NumCast>(n: T) -> U {
348340
NumCast::from(n)
349341
}
350342

343+
///
351344
/// An interface for casting between machine scalars
345+
///
352346
pub trait NumCast {
353347
fn from<T:NumCast>(n: T) -> Self;
354348

@@ -420,6 +414,7 @@ pub trait FromStrRadix {
420414
pub fn from_str_radix(str: &str, radix: uint) -> Option<Self>;
421415
}
422416

417+
///
423418
/// Calculates a power to a given radix, optimized for uint `pow` and `radix`.
424419
///
425420
/// Returns `radix^pow` as `T`.

branches/snap-stage3/src/libstd/rt/comm.rs

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -674,10 +674,11 @@ mod test {
674674
do run_in_newsched_task {
675675
let (port, chan) = oneshot::<int>();
676676
let port_cell = Cell::new(port);
677-
let _thread = do spawntask_thread {
677+
let thread = do spawntask_thread {
678678
let _p = port_cell.take();
679679
};
680680
let _chan = chan;
681+
thread.join();
681682
}
682683
}
683684
}
@@ -689,13 +690,15 @@ mod test {
689690
let (port, chan) = oneshot::<int>();
690691
let chan_cell = Cell::new(chan);
691692
let port_cell = Cell::new(port);
692-
let _thread1 = do spawntask_thread {
693+
let thread1 = do spawntask_thread {
693694
let _p = port_cell.take();
694695
};
695-
let _thread2 = do spawntask_thread {
696+
let thread2 = do spawntask_thread {
696697
let c = chan_cell.take();
697698
c.send(1);
698699
};
700+
thread1.join();
701+
thread2.join();
699702
}
700703
}
701704
}
@@ -707,19 +710,21 @@ mod test {
707710
let (port, chan) = oneshot::<int>();
708711
let chan_cell = Cell::new(chan);
709712
let port_cell = Cell::new(port);
710-
let _thread1 = do spawntask_thread {
713+
let thread1 = do spawntask_thread {
711714
let port_cell = Cell::new(port_cell.take());
712715
let res = do spawntask_try {
713716
port_cell.take().recv();
714717
};
715718
assert!(res.is_err());
716719
};
717-
let _thread2 = do spawntask_thread {
720+
let thread2 = do spawntask_thread {
718721
let chan_cell = Cell::new(chan_cell.take());
719722
do spawntask {
720723
chan_cell.take();
721724
}
722725
};
726+
thread1.join();
727+
thread2.join();
723728
}
724729
}
725730
}
@@ -731,12 +736,14 @@ mod test {
731736
let (port, chan) = oneshot::<~int>();
732737
let chan_cell = Cell::new(chan);
733738
let port_cell = Cell::new(port);
734-
let _thread1 = do spawntask_thread {
739+
let thread1 = do spawntask_thread {
735740
chan_cell.take().send(~10);
736741
};
737-
let _thread2 = do spawntask_thread {
742+
let thread2 = do spawntask_thread {
738743
assert!(port_cell.take().recv() == ~10);
739744
};
745+
thread1.join();
746+
thread2.join();
740747
}
741748
}
742749
}

branches/snap-stage3/src/libstd/rt/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,9 @@ fn run_(main: ~fn(), use_main_sched: bool) -> int {
343343
}
344344

345345
// Wait for schedulers
346-
{ let _threads = threads; }
346+
for threads.consume_iter().advance() |thread| {
347+
thread.join();
348+
}
347349

348350
// Return the exit code
349351
unsafe {

branches/snap-stage3/src/libstd/rt/sched.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -901,10 +901,8 @@ mod test {
901901
sched.run();
902902
};
903903

904-
// wait for the end
905-
let _thread1 = normal_thread;
906-
let _thread2 = special_thread;
907-
904+
normal_thread.join();
905+
special_thread.join();
908906
}
909907
}
910908

@@ -1074,16 +1072,19 @@ mod test {
10741072
sched2.enqueue_task(task2);
10751073

10761074
let sched1_cell = Cell::new(sched1);
1077-
let _thread1 = do Thread::start {
1075+
let thread1 = do Thread::start {
10781076
let sched1 = sched1_cell.take();
10791077
sched1.run();
10801078
};
10811079

10821080
let sched2_cell = Cell::new(sched2);
1083-
let _thread2 = do Thread::start {
1081+
let thread2 = do Thread::start {
10841082
let sched2 = sched2_cell.take();
10851083
sched2.run();
10861084
};
1085+
1086+
thread1.join();
1087+
thread2.join();
10871088
}
10881089
}
10891090

branches/snap-stage3/src/libstd/rt/task.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl Drop for Task {
219219
impl Coroutine {
220220

221221
pub fn new(stack_pool: &mut StackPool, start: ~fn()) -> Coroutine {
222-
static MIN_STACK_SIZE: uint = 100000; // XXX: Too much stack
222+
static MIN_STACK_SIZE: uint = 2000000; // XXX: Too much stack
223223

224224
let start = Coroutine::build_start_wrapper(start);
225225
let mut stack = stack_pool.take_segment(MIN_STACK_SIZE);

branches/snap-stage3/src/libstd/rt/test.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ pub fn run_in_mt_newsched_task(f: ~fn()) {
125125
}
126126

127127
// Wait for schedulers
128-
let _threads = threads;
128+
for threads.consume_iter().advance() |thread| {
129+
thread.join();
130+
}
129131
}
130132

131133
}

0 commit comments

Comments
 (0)