Skip to content

Commit 018d605

Browse files
committed
std: Get stdtest all passing again
This commit brings the library up-to-date in order to get all tests passing again
1 parent d830fcc commit 018d605

29 files changed

+451
-590
lines changed

mk/host.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ define CP_HOST_STAGE_N
2424
# Note: $(3) and $(4) are both the same!
2525

2626
$$(HBIN$(2)_H_$(4))/rustc$$(X_$(4)): \
27-
$$(TBIN$(1)_T_$(4)_H_$(3))/rustc$$(X_$(4))
27+
$$(TBIN$(1)_T_$(4)_H_$(3))/rustc$$(X_$(4)) \
2828
$$(HLIBRUSTC_DEFAULT$(2)_H_$(4)) \
2929
| $$(HBIN$(2)_H_$(4))/
3030
@$$(call E, cp: $$@)

mk/tests.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -348,13 +348,13 @@ STDTESTDEP_$(1)_$(2)_$(3) =
348348
endif
349349

350350
$(3)/stage$(1)/test/stdtest-$(2)$$(X_$(2)): \
351-
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
351+
$$(STDLIB_CRATE) $$(STDLIB_INPUTS) \
352352
$$(STDTESTDEP_$(1)_$(2)_$(3))
353353
@$$(call E, compile_and_link: $$@)
354354
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test
355355

356356
$(3)/stage$(1)/test/extratest-$(2)$$(X_$(2)): \
357-
$$(EXTRALIB_CRATE) $$(EXTRALIB_INPUTS) \
357+
$$(EXTRALIB_CRATE) $$(EXTRALIB_INPUTS) \
358358
$$(STDTESTDEP_$(1)_$(2)_$(3))
359359
@$$(call E, compile_and_link: $$@)
360360
$$(STAGE$(1)_T_$(2)_H_$(3)) -o $$@ $$< --test

src/driver/driver.rs

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

11+
#[cfg(stage0)] extern mod green;
12+
1113
#[cfg(rustpkg)]
1214
extern mod this = "rustpkg";
1315

src/libgreen/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ pub mod sleeper_list;
5757
pub mod stack;
5858
pub mod task;
5959

60+
#[cfg(test)] mod tests;
61+
6062
#[cfg(stage0)]
6163
#[lang = "start"]
6264
pub fn lang_start(main: *u8, argc: int, argv: **u8) -> int {

src/libnative/task.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use std::rt::task::{Task, BlockedTask};
2222
use std::rt::thread::Thread;
2323
use std::rt;
2424
use std::sync::atomics::{AtomicUint, SeqCst, INIT_ATOMIC_UINT};
25-
use std::task::TaskOpts;
25+
use std::task::{TaskOpts, default_task_opts};
2626
use std::unstable::mutex::{Mutex, MUTEX_INIT};
2727
use std::unstable::stack;
2828

@@ -73,9 +73,14 @@ pub fn new() -> ~Task {
7373
return task;
7474
}
7575

76+
/// Spawns a function with the default configuration
77+
pub fn spawn(f: proc()) {
78+
spawn_opts(default_task_opts(), f)
79+
}
80+
7681
/// Spawns a new task given the configuration options and a procedure to run
7782
/// inside the task.
78-
pub fn spawn(opts: TaskOpts, f: proc()) {
83+
pub fn spawn_opts(opts: TaskOpts, f: proc()) {
7984
// must happen before the spawn, no need to synchronize with a lock.
8085
unsafe { THREAD_CNT.fetch_add(1, SeqCst); }
8186

@@ -238,7 +243,7 @@ impl rt::Runtime for Ops {
238243
cur_task.put_runtime(self as ~rt::Runtime);
239244
Local::put(cur_task);
240245

241-
task::spawn(opts, f);
246+
task::spawn_opts(opts, f);
242247
}
243248

244249
fn local_io<'a>(&'a mut self) -> Option<rtio::LocalIo<'a>> {

src/libstd/any.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ impl<'a> AnyMutRefExt<'a> for &'a mut Any {
119119
/// Extension methods for a owning `Any` trait object
120120
pub trait AnyOwnExt {
121121
/// Returns the boxed value if it is of type `T`, or
122-
/// `None` if it isn't.
122+
/// `Err(Self)` if it isn't.
123123
fn move<T: 'static>(self) -> Result<~T, Self>;
124124
}
125125

@@ -156,9 +156,8 @@ impl<'a> ToStr for &'a Any {
156156

157157
#[cfg(test)]
158158
mod tests {
159+
use prelude::*;
159160
use super::*;
160-
use super::AnyRefExt;
161-
use option::{Some, None};
162161

163162
#[deriving(Eq)]
164163
struct Test;
@@ -385,8 +384,14 @@ mod tests {
385384
let a = ~8u as ~Any;
386385
let b = ~Test as ~Any;
387386

388-
assert_eq!(a.move(), Ok(~8u));
389-
assert_eq!(b.move(), Ok(~Test));
387+
match a.move::<uint>() {
388+
Ok(a) => { assert_eq!(a, ~8u); }
389+
Err(..) => fail!()
390+
}
391+
match b.move::<Test>() {
392+
Ok(a) => { assert_eq!(a, ~Test); }
393+
Err(..) => fail!()
394+
}
390395

391396
let a = ~8u as ~Any;
392397
let b = ~Test as ~Any;

0 commit comments

Comments
 (0)