Skip to content

Commit a116031

Browse files
committed
---
yaml --- r: 64904 b: refs/heads/snap-stage3 c: 6296dc0 h: refs/heads/master v: v3
1 parent 5a93358 commit a116031

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+1415
-558
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: 428ea7d7ce39c46a57eaf09b10d9a3d4a488e6e8
4+
refs/heads/snap-stage3: 6296dc0d73527301f18ef55b5f2d07c3241b8a00
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: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,16 @@ ifdef CHECK_XFAILS
3434
TESTARGS += --ignored
3535
endif
3636

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

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

4549
# Arguments to the perf tests
@@ -69,12 +73,12 @@ TEST_RATCHET_NOISE_PERCENT=10.0
6973
# Whether to ratchet or merely save benchmarks
7074
ifdef CFG_RATCHET_BENCH
7175
CRATE_TEST_BENCH_ARGS=\
72-
--test $(CTEST_BENCH) \
76+
--test $(TEST_BENCH) \
7377
--ratchet-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4)) \
7478
--ratchet-noise-percent $(TEST_RATCHET_NOISE_PERCENT)
7579
else
7680
CRATE_TEST_BENCH_ARGS=\
77-
--test $(CTEST_BENCH) \
81+
--test $(TEST_BENCH) \
7882
--save-metrics $(call TEST_RATCHET_FILE,$(1),$(2),$(3),$(4))
7983
endif
8084

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-
unsafe { x.unwrap() }
139+
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 = unsafe { x.unwrap() };
253+
let inner = 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 = unsafe { x.unwrap() };
472+
let inner = 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: 47 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ 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 and does not take an argument
143+
/** Create an option that is optional, does not take an argument,
144+
* and may occur multiple times.
145+
*/
144146
pub fn optflagmulti(name: &str) -> Opt {
145147
return Opt {name: mkname(name), hasarg: No, occur: Multi};
146148
}
@@ -369,7 +371,14 @@ fn opt_vals(mm: &Matches, nm: &str) -> ~[Optval] {
369371
};
370372
}
371373

372-
fn opt_val(mm: &Matches, nm: &str) -> Optval { opt_vals(mm, nm)[0].clone() }
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+
}
373382

374383
/// Returns true if an option was matched
375384
pub fn opt_present(mm: &Matches, nm: &str) -> bool {
@@ -400,7 +409,10 @@ pub fn opts_present(mm: &Matches, names: &[~str]) -> bool {
400409
* argument
401410
*/
402411
pub fn opt_str(mm: &Matches, nm: &str) -> ~str {
403-
return match opt_val(mm, nm) { Val(s) => s, _ => fail!() };
412+
return match opt_val(mm, nm) {
413+
Some(Val(s)) => s,
414+
_ => fail!()
415+
};
404416
}
405417

406418
/**
@@ -412,7 +424,7 @@ pub fn opt_str(mm: &Matches, nm: &str) -> ~str {
412424
pub fn opts_str(mm: &Matches, names: &[~str]) -> ~str {
413425
for names.iter().advance |nm| {
414426
match opt_val(mm, *nm) {
415-
Val(ref s) => return (*s).clone(),
427+
Some(Val(ref s)) => return (*s).clone(),
416428
_ => ()
417429
}
418430
}
@@ -1318,24 +1330,41 @@ mod tests {
13181330
13191331
#[test]
13201332
fn test_multi() {
1321-
let args = ~[~"-e", ~"foo", ~"--encrypt", ~"foo"];
13221333
let opts = ~[optopt("e"), optopt("encrypt"), optopt("f")];
1323-
let matches = &match getopts(args, opts) {
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) {
13241353
result::Ok(m) => m,
13251354
result::Err(_) => fail!()
13261355
};
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");
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");
13391368
}
13401369
13411370
#[test]

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

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

154152
pub fn access_waitqueue<U>(&self, blk: &fn() -> U) -> U {
155153
let mut release = None;
156-
unsafe {
157-
do task::unkillable {
158-
self.acquire();
159-
release = Some(SemAndSignalRelease(self));
160-
}
154+
do task::unkillable {
155+
self.acquire();
156+
release = Some(SemAndSignalRelease(self));
161157
}
162158
blk()
163159
}
@@ -294,17 +290,15 @@ impl<'self> Condvar<'self> {
294290
#[unsafe_destructor]
295291
impl<'self> Drop for CondvarReacquire<'self> {
296292
fn drop(&self) {
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-
}
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+
},
308302
}
309303
}
310304
}
@@ -644,14 +638,12 @@ impl RWLock {
644638
// Implementation slightly different from the slicker 'write's above.
645639
// The exit path is conditional on whether the caller downgrades.
646640
let mut _release = None;
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));
641+
do task::unkillable {
642+
(&self.order_lock).acquire();
643+
(&self.access_lock).acquire();
644+
(&self.order_lock).release();
654645
}
646+
_release = Some(RWLockReleaseDowngrade(self));
655647
blk(RWLockWriteMode { lock: self })
656648
}
657649

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

branches/snap-stage3/src/librustc/middle/cfg/construct.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,8 @@ impl CFGBuilder {
239239
expr_exit
240240
}
241241

242+
ast::expr_for_loop(*) => fail!("non-desugared expr_for_loop"),
243+
242244
ast::expr_loop(ref body, _) => {
243245
//
244246
// [pred]

branches/snap-stage3/src/librustc/middle/dataflow.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,8 @@ impl<'self, O:DataFlowOperator> PropagationContext<'self, O> {
583583
copy_bits(new_loop_scope.break_bits, in_out);
584584
}
585585

586+
ast::expr_for_loop(*) => fail!("non-desugared expr_for_loop"),
587+
586588
ast::expr_loop(ref blk, _) => {
587589
//
588590
// (expr) <--+

branches/snap-stage3/src/librustc/middle/liveness.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ fn visit_expr(expr: @expr, (this, vt): (@mut IrMaps, vt<@mut IrMaps>)) {
503503
this.add_live_node_for_node(expr.id, ExprNode(expr.span));
504504
visit::visit_expr(expr, (this, vt));
505505
}
506+
expr_for_loop(*) => fail!("non-desugared expr_for_loop"),
506507
expr_binary(_, op, _, _) if ast_util::lazy_binop(op) => {
507508
this.add_live_node_for_node(expr.id, ExprNode(expr.span));
508509
visit::visit_expr(expr, (this, vt));
@@ -1057,6 +1058,8 @@ impl Liveness {
10571058
self.propagate_through_loop(expr, Some(cond), blk, succ)
10581059
}
10591060

1061+
expr_for_loop(*) => fail!("non-desugared expr_for_loop"),
1062+
10601063
// Note that labels have been resolved, so we don't need to look
10611064
// at the label ident
10621065
expr_loop(ref blk, _) => {
@@ -1487,6 +1490,7 @@ fn check_expr(expr: @expr, (this, vt): (@Liveness, vt<@Liveness>)) {
14871490
expr_paren(*) | expr_fn_block(*) | expr_path(*) | expr_self(*) => {
14881491
visit::visit_expr(expr, (this, vt));
14891492
}
1493+
expr_for_loop(*) => fail!("non-desugared expr_for_loop")
14901494
}
14911495
}
14921496

branches/snap-stage3/src/librustc/middle/mem_categorization.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,8 @@ impl mem_categorization_ctxt {
435435
ast::expr_inline_asm(*) => {
436436
return self.cat_rvalue_node(expr, expr_ty);
437437
}
438+
439+
ast::expr_for_loop(*) => fail!("non-desugared expr_for_loop")
438440
}
439441
}
440442

branches/snap-stage3/src/librustc/middle/moves.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,8 @@ impl VisitContext {
487487
self.consume_block(blk, visitor);
488488
}
489489

490+
expr_for_loop(*) => fail!("non-desugared expr_for_loop"),
491+
490492
expr_unary(_, _, lhs) => {
491493
if !self.use_overloaded_operator(
492494
expr, lhs, [], visitor)

branches/snap-stage3/src/librustc/middle/resolve.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5016,6 +5016,8 @@ impl Resolver {
50165016
}
50175017
}
50185018

5019+
expr_for_loop(*) => fail!("non-desugared expr_for_loop"),
5020+
50195021
expr_break(Some(label)) | expr_again(Some(label)) => {
50205022
match self.search_ribs(self.label_ribs, label, expr.span,
50215023
DontAllowCapturingSelf) {

branches/snap-stage3/src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2266,7 +2266,7 @@ pub fn register_fn_fuller(ccx: @mut CrateContext,
22662266
sp: span,
22672267
sym: ~str,
22682268
node_id: ast::NodeId,
2269-
node_type: ty::t,
2269+
_node_type: ty::t,
22702270
cc: lib::llvm::CallConv,
22712271
fn_ty: Type)
22722272
-> ValueRef {

branches/snap-stage3/src/librustc/middle/trans/type_use.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,9 @@ pub fn mark_for_expr(cx: &Context, e: &expr) {
401401
expr_match(*) | expr_block(_) | expr_if(*) | expr_while(*) |
402402
expr_break(_) | expr_again(_) | expr_unary(*) | expr_lit(_) |
403403
expr_mac(_) | expr_addr_of(*) | expr_ret(_) | expr_loop(*) |
404-
expr_loop_body(_) | expr_do_body(_) => ()
404+
expr_loop_body(_) | expr_do_body(_) => (),
405+
406+
expr_for_loop(*) => fail!("non-desugared expr_for_loop")
405407
}
406408
}
407409

branches/snap-stage3/src/librustc/middle/ty.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3240,6 +3240,8 @@ pub fn expr_kind(tcx: ctxt,
32403240
RvalueStmtExpr
32413241
}
32423242

3243+
ast::expr_for_loop(*) => fail!("non-desugared expr_for_loop"),
3244+
32433245
ast::expr_lit(_) | // Note: lit_str is carved out above
32443246
ast::expr_unary(*) |
32453247
ast::expr_addr_of(*) |

branches/snap-stage3/src/librustc/middle/typeck/check/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2559,6 +2559,8 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
25592559
fcx.write_nil(id);
25602560
}
25612561
}
2562+
ast::expr_for_loop(*) =>
2563+
fail!("non-desugared expr_for_loop"),
25622564
ast::expr_loop(ref body, _) => {
25632565
check_block_no_value(fcx, (body));
25642566
if !may_break(tcx, expr.id, body) {

branches/snap-stage3/src/librustc/middle/typeck/check/regionck.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,6 +1041,7 @@ pub mod guarantor {
10411041
rcx.fcx.tcx(), rcx.fcx.inh.method_map, expr));
10421042
None
10431043
}
1044+
ast::expr_for_loop(*) => fail!("non-desugared expr_for_loop"),
10441045
}
10451046
}
10461047

0 commit comments

Comments
 (0)