Skip to content

Commit 5a93358

Browse files
committed
---
yaml --- r: 64903 b: refs/heads/snap-stage3 c: 428ea7d h: refs/heads/master i: 64901: dd985b6 64899: 7c9ccfb 64895: 1479eb7 v: v3
1 parent 655d5df commit 5a93358

29 files changed

+554
-1041
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: 8b7e241e02bb9f82d7b931033afde477d03ff4f2
4+
refs/heads/snap-stage3: 428ea7d7ce39c46a57eaf09b10d9a3d4a488e6e8
55
refs/heads/try: 7b78b52e602bb3ea8174f9b2006bff3315f03ef9
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/mk/tests.mk

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,12 @@ ifdef CHECK_XFAILS
3434
TESTARGS += --ignored
3535
endif
3636

37-
TEST_BENCH = --bench
37+
CTEST_BENCH = --bench
3838

3939
# Arguments to the cfail/rfail/rpass/bench tests
4040
ifdef CFG_VALGRIND
4141
CTEST_RUNTOOL = --runtool "$(CFG_VALGRIND)"
42-
TEST_BENCH =
43-
endif
44-
45-
ifdef NO_BENCH
46-
TEST_BENCH =
42+
CTEST_BENCH =
4743
endif
4844

4945
# Arguments to the perf tests
@@ -73,12 +69,12 @@ TEST_RATCHET_NOISE_PERCENT=10.0
7369
# Whether to ratchet or merely save benchmarks
7470
ifdef CFG_RATCHET_BENCH
7571
CRATE_TEST_BENCH_ARGS=\
76-
--test $(TEST_BENCH) \
72+
--test $(CTEST_BENCH) \
7773
--ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
7874
--ratchet-noise-percent $(TEST_RATCHET_NOISE_PERCENT)
7975
else
8076
CRATE_TEST_BENCH_ARGS=\
81-
--test $(TEST_BENCH) \
77+
--test $(CTEST_BENCH) \
8278
--save-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4))
8379
endif
8480

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl<T:Freeze+Send> Arc<T> {
136136
*/
137137
pub fn unwrap(self) -> T {
138138
let Arc { x: x } = self;
139-
x.unwrap()
139+
unsafe { x.unwrap() }
140140
}
141141
}
142142

@@ -250,7 +250,7 @@ impl<T:Send> MutexArc<T> {
250250
*/
251251
pub fn unwrap(self) -> T {
252252
let MutexArc { x: x } = self;
253-
let inner = x.unwrap();
253+
let inner = unsafe { x.unwrap() };
254254
let MutexArcInner { failed: failed, data: data, _ } = inner;
255255
if failed {
256256
fail!(~"Can't unwrap poisoned MutexArc - another task failed inside!");
@@ -469,7 +469,7 @@ impl<T:Freeze + Send> RWArc<T> {
469469
*/
470470
pub fn unwrap(self) -> T {
471471
let RWArc { x: x, _ } = self;
472-
let inner = x.unwrap();
472+
let inner = unsafe { x.unwrap() };
473473
let RWArcInner { failed: failed, data: data, _ } = inner;
474474
if failed {
475475
fail!(~"Can't unwrap poisoned RWArc - another task failed inside!")

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

Lines changed: 18 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,7 @@ pub fn optflag(name: &str) -> Opt {
140140
return Opt {name: mkname(name), hasarg: No, occur: Optional};
141141
}
142142

143-
/** Create an option that is optional, does not take an argument,
144-
* and may occur multiple times.
145-
*/
143+
/// Create an option that is optional and does not take an argument
146144
pub fn optflagmulti(name: &str) -> Opt {
147145
return Opt {name: mkname(name), hasarg: No, occur: Multi};
148146
}
@@ -371,14 +369,7 @@ fn opt_vals(mm: &Matches, nm: &str) -> ~[Optval] {
371369
};
372370
}
373371

374-
fn opt_val(mm: &Matches, nm: &str) -> Option<Optval> {
375-
let vals = opt_vals(mm, nm);
376-
if (vals.is_empty()) {
377-
None
378-
} else {
379-
Some(opt_vals(mm, nm)[0].clone())
380-
}
381-
}
372+
fn opt_val(mm: &Matches, nm: &str) -> Optval { opt_vals(mm, nm)[0].clone() }
382373

383374
/// Returns true if an option was matched
384375
pub fn opt_present(mm: &Matches, nm: &str) -> bool {
@@ -409,10 +400,7 @@ pub fn opts_present(mm: &Matches, names: &[~str]) -> bool {
409400
* argument
410401
*/
411402
pub fn opt_str(mm: &Matches, nm: &str) -> ~str {
412-
return match opt_val(mm, nm) {
413-
Some(Val(s)) => s,
414-
_ => fail!()
415-
};
403+
return match opt_val(mm, nm) { Val(s) => s, _ => fail!() };
416404
}
417405

418406
/**
@@ -424,7 +412,7 @@ pub fn opt_str(mm: &Matches, nm: &str) -> ~str {
424412
pub fn opts_str(mm: &Matches, names: &[~str]) -> ~str {
425413
for names.iter().advance |nm| {
426414
match opt_val(mm, *nm) {
427-
Some(Val(ref s)) => return (*s).clone(),
415+
Val(ref s) => return (*s).clone(),
428416
_ => ()
429417
}
430418
}
@@ -1330,41 +1318,24 @@ mod tests {
13301318
13311319
#[test]
13321320
fn test_multi() {
1321+
let args = ~[~"-e", ~"foo", ~"--encrypt", ~"foo"];
13331322
let opts = ~[optopt("e"), optopt("encrypt"), optopt("f")];
1334-
1335-
let args_single = ~[~"-e", ~"foo"];
1336-
let matches_single = &match getopts(args_single, opts) {
1337-
result::Ok(m) => m,
1338-
result::Err(_) => fail!()
1339-
};
1340-
assert!(opts_present(matches_single, [~"e"]));
1341-
assert!(opts_present(matches_single, [~"encrypt", ~"e"]));
1342-
assert!(opts_present(matches_single, [~"e", ~"encrypt"]));
1343-
assert!(!opts_present(matches_single, [~"encrypt"]));
1344-
assert!(!opts_present(matches_single, [~"thing"]));
1345-
assert!(!opts_present(matches_single, []));
1346-
1347-
assert_eq!(opts_str(matches_single, [~"e"]), ~"foo");
1348-
assert_eq!(opts_str(matches_single, [~"e", ~"encrypt"]), ~"foo");
1349-
assert_eq!(opts_str(matches_single, [~"encrypt", ~"e"]), ~"foo");
1350-
1351-
let args_both = ~[~"-e", ~"foo", ~"--encrypt", ~"foo"];
1352-
let matches_both = &match getopts(args_both, opts) {
1323+
let matches = &match getopts(args, opts) {
13531324
result::Ok(m) => m,
13541325
result::Err(_) => fail!()
13551326
};
1356-
assert!(opts_present(matches_both, [~"e"]));
1357-
assert!(opts_present(matches_both, [~"encrypt"]));
1358-
assert!(opts_present(matches_both, [~"encrypt", ~"e"]));
1359-
assert!(opts_present(matches_both, [~"e", ~"encrypt"]));
1360-
assert!(!opts_present(matches_both, [~"f"]));
1361-
assert!(!opts_present(matches_both, [~"thing"]));
1362-
assert!(!opts_present(matches_both, []));
1363-
1364-
assert_eq!(opts_str(matches_both, [~"e"]), ~"foo");
1365-
assert_eq!(opts_str(matches_both, [~"encrypt"]), ~"foo");
1366-
assert_eq!(opts_str(matches_both, [~"e", ~"encrypt"]), ~"foo");
1367-
assert_eq!(opts_str(matches_both, [~"encrypt", ~"e"]), ~"foo");
1327+
assert!(opts_present(matches, [~"e"]));
1328+
assert!(opts_present(matches, [~"encrypt"]));
1329+
assert!(opts_present(matches, [~"encrypt", ~"e"]));
1330+
assert!(opts_present(matches, [~"e", ~"encrypt"]));
1331+
assert!(!opts_present(matches, [~"f"]));
1332+
assert!(!opts_present(matches, [~"thing"]));
1333+
assert!(!opts_present(matches, []));
1334+
1335+
assert_eq!(opts_str(matches, [~"e"]), ~"foo");
1336+
assert_eq!(opts_str(matches, [~"encrypt"]), ~"foo");
1337+
assert_eq!(opts_str(matches, [~"e", ~"encrypt"]), ~"foo");
1338+
assert_eq!(opts_str(matches, [~"encrypt", ~"e"]), ~"foo");
13681339
}
13691340
13701341
#[test]

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

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,11 @@ impl<Q:Send> Sem<Q> {
130130
impl Sem<()> {
131131
pub fn access<U>(&self, blk: &fn() -> U) -> U {
132132
let mut release = None;
133-
do task::unkillable {
134-
self.acquire();
135-
release = Some(SemRelease(self));
133+
unsafe {
134+
do task::unkillable {
135+
self.acquire();
136+
release = Some(SemRelease(self));
137+
}
136138
}
137139
blk()
138140
}
@@ -151,9 +153,11 @@ impl Sem<~[WaitQueue]> {
151153

152154
pub fn access_waitqueue<U>(&self, blk: &fn() -> U) -> U {
153155
let mut release = None;
154-
do task::unkillable {
155-
self.acquire();
156-
release = Some(SemAndSignalRelease(self));
156+
unsafe {
157+
do task::unkillable {
158+
self.acquire();
159+
release = Some(SemAndSignalRelease(self));
160+
}
157161
}
158162
blk()
159163
}
@@ -290,15 +294,17 @@ impl<'self> Condvar<'self> {
290294
#[unsafe_destructor]
291295
impl<'self> Drop for CondvarReacquire<'self> {
292296
fn drop(&self) {
293-
// Needs to succeed, instead of itself dying.
294-
do task::unkillable {
295-
match self.order {
296-
Just(lock) => do lock.access {
297-
self.sem.acquire();
298-
},
299-
Nothing => {
300-
self.sem.acquire();
301-
},
297+
unsafe {
298+
// Needs to succeed, instead of itself dying.
299+
do task::unkillable {
300+
match self.order {
301+
Just(lock) => do lock.access {
302+
self.sem.acquire();
303+
},
304+
Nothing => {
305+
self.sem.acquire();
306+
},
307+
}
302308
}
303309
}
304310
}
@@ -638,12 +644,14 @@ impl RWLock {
638644
// Implementation slightly different from the slicker 'write's above.
639645
// The exit path is conditional on whether the caller downgrades.
640646
let mut _release = None;
641-
do task::unkillable {
642-
(&self.order_lock).acquire();
643-
(&self.access_lock).acquire();
644-
(&self.order_lock).release();
647+
unsafe {
648+
do task::unkillable {
649+
(&self.order_lock).acquire();
650+
(&self.access_lock).acquire();
651+
(&self.order_lock).release();
652+
}
653+
_release = Some(RWLockReleaseDowngrade(self));
645654
}
646-
_release = Some(RWLockReleaseDowngrade(self));
647655
blk(RWLockWriteMode { lock: self })
648656
}
649657

@@ -882,7 +890,7 @@ mod tests {
882890
fn test_sem_runtime_friendly_blocking() {
883891
// Force the runtime to schedule two threads on the same sched_loop.
884892
// When one blocks, it should schedule the other one.
885-
do task::spawn_sched(task::SingleThreaded) {
893+
do task::spawn_sched(task::ManualThreads(1)) {
886894
let s = ~Semaphore::new(1);
887895
let s2 = ~s.clone();
888896
let (p,c) = comm::stream();

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

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ impl GenericPath for PosixPath {
587587
}
588588

589589
fn with_filename(&self, f: &str) -> PosixPath {
590-
assert!(!f.iter().all(posix::is_sep));
590+
assert!(! f.iter().all(windows::is_sep));
591591
self.dir_path().push(f)
592592
}
593593

@@ -648,7 +648,7 @@ impl GenericPath for PosixPath {
648648
fn push_many<S: Str>(&self, cs: &[S]) -> PosixPath {
649649
let mut v = self.components.clone();
650650
for cs.iter().advance |e| {
651-
for e.as_slice().split_iter(posix::is_sep).advance |s| {
651+
for e.as_slice().split_iter(windows::is_sep).advance |s| {
652652
if !s.is_empty() {
653653
v.push(s.to_owned())
654654
}
@@ -662,7 +662,7 @@ impl GenericPath for PosixPath {
662662

663663
fn push(&self, s: &str) -> PosixPath {
664664
let mut v = self.components.clone();
665-
for s.split_iter(posix::is_sep).advance |s| {
665+
for s.split_iter(windows::is_sep).advance |s| {
666666
if !s.is_empty() {
667667
v.push(s.to_owned())
668668
}
@@ -1001,17 +1001,7 @@ pub fn normalize(components: &[~str]) -> ~[~str] {
10011001
cs
10021002
}
10031003

1004-
// Various posix helpers.
1005-
pub mod posix {
1006-
1007-
#[inline]
1008-
pub fn is_sep(u: char) -> bool {
1009-
u == '/'
1010-
}
1011-
1012-
}
1013-
1014-
// Various windows helpers.
1004+
// Various windows helpers, and tests for the impl.
10151005
pub mod windows {
10161006
use libc;
10171007
use option::{None, Option, Some};
@@ -1149,14 +1139,6 @@ mod tests {
11491139

11501140
}
11511141

1152-
#[test]
1153-
fn test_posix_push_with_backslash() {
1154-
let a = PosixPath("/aaa/bbb");
1155-
let b = a.push("x\\y"); // \ is not a file separator for posix paths
1156-
assert_eq!(a.components.len(), 2);
1157-
assert_eq!(b.components.len(), 3);
1158-
}
1159-
11601142
#[test]
11611143
fn test_normalize() {
11621144
fn t(wp: &PosixPath, s: &str) {

0 commit comments

Comments
 (0)