Skip to content

Commit 9a17ef9

Browse files
committed
librustc: Stop parsing assert.
1 parent d7e74b5 commit 9a17ef9

File tree

16 files changed

+38
-77
lines changed

16 files changed

+38
-77
lines changed

src/libfuzzer/fuzzer.rc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,7 @@ pub pure fn safe_to_use_expr(e: ast::expr, tm: test_mode) -> bool {
109109
| ast::expr_match(*) | ast::expr_while(*) => { false }
110110

111111
// https://github.com/mozilla/rust/issues/929
112-
ast::expr_cast(*) | ast::expr_assert(*) |
113-
ast::expr_binary(*) | ast::expr_assign(*) |
112+
ast::expr_cast(*) | ast::expr_binary(*) | ast::expr_assign(*) |
114113
ast::expr_assign_op(*) => { false }
115114

116115
ast::expr_ret(option::None) => { false }

src/librustc/middle/liveness.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -617,11 +617,11 @@ fn visit_expr(expr: @expr, &&self: @mut IrMaps, vt: vt<@mut IrMaps>) {
617617
// otherwise, live nodes are not required:
618618
expr_index(*) | expr_field(*) | expr_vstore(*) | expr_vec(*) |
619619
expr_call(*) | expr_method_call(*) | expr_tup(*) | expr_log(*) |
620-
expr_binary(*) | expr_assert(*) | expr_addr_of(*) | expr_copy(*) |
621-
expr_loop_body(*) | expr_do_body(*) | expr_cast(*) | expr_unary(*) |
622-
expr_break(_) | expr_again(_) | expr_lit(_) | expr_ret(*) |
623-
expr_block(*) | expr_assign(*) | expr_swap(*) | expr_assign_op(*) |
624-
expr_mac(*) | expr_struct(*) | expr_repeat(*) | expr_paren(*) => {
620+
expr_binary(*) | expr_addr_of(*) | expr_copy(*) | expr_loop_body(*) |
621+
expr_do_body(*) | expr_cast(*) | expr_unary(*) | expr_break(_) |
622+
expr_again(_) | expr_lit(_) | expr_ret(*) | expr_block(*) |
623+
expr_assign(*) | expr_swap(*) | expr_assign_op(*) | expr_mac(*) |
624+
expr_struct(*) | expr_repeat(*) | expr_paren(*) => {
625625
visit::visit_expr(expr, self, vt);
626626
}
627627
}
@@ -1332,7 +1332,6 @@ pub impl Liveness {
13321332
self.propagate_through_exprs(~[l, r], succ)
13331333
}
13341334

1335-
expr_assert(e) |
13361335
expr_addr_of(_, e) |
13371336
expr_copy(e) |
13381337
expr_loop_body(e) |
@@ -1493,8 +1492,9 @@ pub impl Liveness {
14931492
// repeat until fixed point is reached:
14941493
while self.merge_from_succ(ln, body_ln, first_merge) {
14951494
first_merge = false;
1496-
fail_unless!(cond_ln == self.propagate_through_opt_expr(cond, ln));
1497-
assert body_ln == self.with_loop_nodes(expr.id, succ, ln,
1495+
fail_unless!(cond_ln == self.propagate_through_opt_expr(cond,
1496+
ln));
1497+
fail_unless!(body_ln == self.with_loop_nodes(expr.id, succ, ln,
14981498
|| {
14991499
self.propagate_through_block(body, cond_ln)
15001500
}));
@@ -1611,11 +1611,11 @@ fn check_expr(expr: @expr, &&self: @Liveness, vt: vt<@Liveness>) {
16111611
expr_call(*) | expr_method_call(*) | expr_if(*) | expr_match(*) |
16121612
expr_while(*) | expr_loop(*) | expr_index(*) | expr_field(*) |
16131613
expr_vstore(*) | expr_vec(*) | expr_tup(*) | expr_log(*) |
1614-
expr_binary(*) | expr_assert(*) | expr_copy(*) | expr_loop_body(*) |
1615-
expr_do_body(*) | expr_cast(*) | expr_unary(*) | expr_ret(*) |
1616-
expr_break(*) | expr_again(*) | expr_lit(_) | expr_block(*) |
1617-
expr_swap(*) | expr_mac(*) | expr_addr_of(*) | expr_struct(*) |
1618-
expr_repeat(*) | expr_paren(*) => {
1614+
expr_binary(*) | expr_copy(*) | expr_loop_body(*) | expr_do_body(*) |
1615+
expr_cast(*) | expr_unary(*) | expr_ret(*) | expr_break(*) |
1616+
expr_again(*) | expr_lit(_) | expr_block(*) | expr_swap(*) |
1617+
expr_mac(*) | expr_addr_of(*) | expr_struct(*) | expr_repeat(*) |
1618+
expr_paren(*) => {
16191619
visit::visit_expr(expr, self, vt);
16201620
}
16211621
}

src/librustc/middle/mem_categorization.rs

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -437,19 +437,17 @@ pub impl mem_categorization_ctxt {
437437

438438
ast::expr_paren(e) => self.cat_expr_unadjusted(e),
439439

440-
ast::expr_addr_of(*) | ast::expr_call(*) |
441-
ast::expr_swap(*) | ast::expr_assign(*) |
442-
ast::expr_assign_op(*) | ast::expr_fn_block(*) |
443-
ast::expr_assert(*) | ast::expr_ret(*) |
444-
ast::expr_loop_body(*) | ast::expr_do_body(*) |
445-
ast::expr_unary(*) | ast::expr_method_call(*) |
446-
ast::expr_copy(*) | ast::expr_cast(*) |
440+
ast::expr_addr_of(*) | ast::expr_call(*) | ast::expr_swap(*) |
441+
ast::expr_assign(*) | ast::expr_assign_op(*) |
442+
ast::expr_fn_block(*) | ast::expr_ret(*) | ast::expr_loop_body(*) |
443+
ast::expr_do_body(*) | ast::expr_unary(*) |
444+
ast::expr_method_call(*) | ast::expr_copy(*) | ast::expr_cast(*) |
447445
ast::expr_vstore(*) | ast::expr_vec(*) | ast::expr_tup(*) |
448-
ast::expr_if(*) | ast::expr_log(*) |
449-
ast::expr_binary(*) | ast::expr_while(*) |
450-
ast::expr_block(*) | ast::expr_loop(*) | ast::expr_match(*) |
451-
ast::expr_lit(*) | ast::expr_break(*) | ast::expr_mac(*) |
452-
ast::expr_again(*) | ast::expr_struct(*) | ast::expr_repeat(*) => {
446+
ast::expr_if(*) | ast::expr_log(*) | ast::expr_binary(*) |
447+
ast::expr_while(*) | ast::expr_block(*) | ast::expr_loop(*) |
448+
ast::expr_match(*) | ast::expr_lit(*) | ast::expr_break(*) |
449+
ast::expr_mac(*) | ast::expr_again(*) | ast::expr_struct(*) |
450+
ast::expr_repeat(*) => {
453451
return self.cat_rvalue(expr, expr_ty);
454452
}
455453
}

src/librustc/middle/moves.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -571,10 +571,6 @@ pub impl VisitContext {
571571
self.use_expr(b_expr, Read, visitor);
572572
}
573573

574-
expr_assert(cond_expr) => {
575-
self.consume_expr(cond_expr, visitor);
576-
}
577-
578574
expr_while(cond_expr, ref blk) => {
579575
self.consume_expr(cond_expr, visitor);
580576
self.consume_block(blk, visitor);

src/librustc/middle/trans/controlflow.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -322,25 +322,6 @@ pub fn trans_ret(bcx: block, e: Option<@ast::expr>) -> block {
322322
return bcx;
323323
}
324324
325-
pub fn trans_check_expr(bcx: block,
326-
chk_expr: @ast::expr,
327-
pred_expr: @ast::expr,
328-
s: &str)
329-
-> block {
330-
let _icx = bcx.insn_ctxt("trans_check_expr");
331-
let expr_str = @(fmt!("%s %s failed",
332-
s, expr_to_str(pred_expr, bcx.ccx().sess.intr())));
333-
let Result {bcx, val} = {
334-
do with_scope_result(bcx, chk_expr.info(), ~"check") |bcx| {
335-
expr::trans_to_datum(bcx, pred_expr).to_result()
336-
}
337-
};
338-
let val = bool_to_i1(bcx, val);
339-
do with_cond(bcx, Not(bcx, val)) |bcx| {
340-
trans_fail(bcx, Some(pred_expr.span), expr_str)
341-
}
342-
}
343-
344325
pub fn trans_fail_expr(bcx: block,
345326
sp_opt: Option<span>,
346327
fail_expr: Option<@ast::expr>)

src/librustc/middle/trans/expr.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -510,9 +510,6 @@ fn trans_rvalue_stmt_unadjusted(bcx: block, expr: @ast::expr) -> block {
510510
ast::expr_log(_, lvl, a) => {
511511
return controlflow::trans_log(expr, lvl, bcx, a);
512512
}
513-
ast::expr_assert(a) => {
514-
return controlflow::trans_check_expr(bcx, expr, a, ~"Assertion");
515-
}
516513
ast::expr_while(cond, ref body) => {
517514
return controlflow::trans_while(bcx, cond, body);
518515
}

src/librustc/middle/trans/type_use.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,10 @@ pub fn mark_for_expr(cx: Context, e: @expr) {
349349
mark_for_method_call(cx, e.id, e.callee_id);
350350
}
351351
expr_paren(e) => mark_for_expr(cx, e),
352-
expr_match(*) | expr_block(_) | expr_if(*) |
353-
expr_while(*) | expr_break(_) | expr_again(_) |
354-
expr_unary(_, _) | expr_lit(_) | expr_assert(_) |
355-
expr_mac(_) | expr_addr_of(_, _) |
356-
expr_ret(_) | expr_loop(_, _) |
352+
353+
expr_match(*) | expr_block(_) | expr_if(*) | expr_while(*) |
354+
expr_break(_) | expr_again(_) | expr_unary(_, _) | expr_lit(_) |
355+
expr_mac(_) | expr_addr_of(_, _) | expr_ret(_) | expr_loop(_, _) |
357356
expr_loop_body(_) | expr_do_body(_) => ()
358357
}
359358
}

src/librustc/middle/ty.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3114,7 +3114,6 @@ pub fn expr_kind(tcx: ctxt,
31143114
ast::expr_again(*) |
31153115
ast::expr_ret(*) |
31163116
ast::expr_log(*) |
3117-
ast::expr_assert(*) |
31183117
ast::expr_while(*) |
31193118
ast::expr_loop(*) |
31203119
ast::expr_assign(*) |

src/librustc/middle/typeck/check/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2309,10 +2309,6 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
23092309
check_expr(fcx, e);
23102310
fcx.write_nil(id);
23112311
}
2312-
ast::expr_assert(e) => {
2313-
bot = check_expr_has_type(fcx, e, ty::mk_bool(tcx));
2314-
fcx.write_nil(id);
2315-
}
23162312
ast::expr_copy(a) => {
23172313
bot = check_expr_with_opt_hint(fcx, a, expected);
23182314
fcx.write_ty(id, fcx.expr_ty(a));

src/librustc/middle/typeck/check/regionck.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,6 @@ pub mod guarantor {
692692
ast::expr_again(*) |
693693
ast::expr_ret(*) |
694694
ast::expr_log(*) |
695-
ast::expr_assert(*) |
696695
ast::expr_while(*) |
697696
ast::expr_loop(*) |
698697
ast::expr_assign(*) |

0 commit comments

Comments
 (0)