Revert "Remove rule requiring non-nil block-style statements to be semi-terminated"
This reverts commit 0f5eaef5fb.
This commit is contained in:
@@ -359,7 +359,7 @@ fn mk_test_wrapper(cx: test_ctxt,
|
||||
};
|
||||
|
||||
let call_stmt: ast::stmt = nospan(
|
||||
ast::stmt_expr(@call_expr, cx.sess.next_node_id()));
|
||||
ast::stmt_semi(@call_expr, cx.sess.next_node_id()));
|
||||
|
||||
let wrapper_decl: ast::fn_decl = {
|
||||
inputs: ~[],
|
||||
|
||||
@@ -229,7 +229,7 @@ fn simplify_ast(ii: ast::inlined_item) -> ast::inlined_item {
|
||||
fn drop_nested_items(blk: ast::blk_, fld: fold::ast_fold) -> ast::blk_ {
|
||||
let stmts_sans_items = do vec::filter(blk.stmts) |stmt| {
|
||||
alt stmt.node {
|
||||
ast::stmt_expr(_, _) |
|
||||
ast::stmt_expr(_, _) | ast::stmt_semi(_, _) |
|
||||
ast::stmt_decl(@{node: ast::decl_local(_), span: _}, _) { true }
|
||||
ast::stmt_decl(@{node: ast::decl_item(_), span: _}, _) { false }
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ fn check_item_path_statement(cx: ty::ctxt, it: @ast::item) {
|
||||
let visit = item_stopping_visitor(visit::mk_simple_visitor(@{
|
||||
visit_stmt: fn@(s: @ast::stmt) {
|
||||
alt s.node {
|
||||
ast::stmt_expr(@{id: id,
|
||||
ast::stmt_semi(@{id: id,
|
||||
node: ast::expr_path(@path),
|
||||
span: _}, _) {
|
||||
cx.sess.span_lint(
|
||||
|
||||
@@ -843,7 +843,7 @@ class liveness {
|
||||
ret self.propagate_through_decl(decl, succ);
|
||||
}
|
||||
|
||||
stmt_expr(expr, _) {
|
||||
stmt_expr(expr, _) | stmt_semi(expr, _) {
|
||||
ret self.propagate_through_expr(expr, succ);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4131,7 +4131,7 @@ fn trans_stmt(cx: block, s: ast::stmt) -> block {
|
||||
debuginfo::update_source_pos(cx, s.span);
|
||||
|
||||
alt s.node {
|
||||
ast::stmt_expr(e, _) {
|
||||
ast::stmt_expr(e, _) | ast::stmt_semi(e, _) {
|
||||
bcx = trans_expr(cx, e, ignore);
|
||||
}
|
||||
ast::stmt_decl(d, _) {
|
||||
|
||||
@@ -15,7 +15,7 @@ fn collect_ids_block(b: blk, rs: @mut ~[node_id]) {
|
||||
|
||||
fn collect_ids_stmt(s: @stmt, rs: @mut ~[node_id]) {
|
||||
alt s.node {
|
||||
stmt_decl(_, id) | stmt_expr(_, id) {
|
||||
stmt_decl(_, id) | stmt_expr(_, id) | stmt_semi(_, id) {
|
||||
#debug["node_id %s", int::str(id)];
|
||||
#debug["%s", stmt_to_str(*s)];
|
||||
vec::push(*rs, id);
|
||||
|
||||
@@ -278,7 +278,7 @@ fn node_id_to_poststate(ccx: crate_ctxt, id: node_id) -> poststate {
|
||||
fn stmt_to_ann(ccx: crate_ctxt, s: stmt) -> ts_ann {
|
||||
#debug("stmt_to_ann");
|
||||
alt s.node {
|
||||
stmt_decl(_, id) | stmt_expr(_, id) {
|
||||
stmt_decl(_, id) | stmt_expr(_, id) | stmt_semi(_, id) {
|
||||
ret node_id_to_ts_ann(ccx, id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,7 +520,7 @@ fn find_pre_post_stmt(fcx: fn_ctxt, s: stmt) {
|
||||
}
|
||||
}
|
||||
}
|
||||
stmt_expr(e, id) {
|
||||
stmt_expr(e, id) | stmt_semi(e, id) {
|
||||
find_pre_post_expr(fcx, e);
|
||||
copy_pre_post(fcx.ccx, id, e);
|
||||
}
|
||||
|
||||
@@ -537,7 +537,7 @@ fn find_pre_post_state_stmt(fcx: fn_ctxt, pres: prestate, s: @stmt) -> bool {
|
||||
}
|
||||
}
|
||||
}
|
||||
stmt_expr(ex, _) {
|
||||
stmt_expr(ex, _) | stmt_semi(ex, _) {
|
||||
let mut changed =
|
||||
find_pre_post_state_expr(fcx, pres, ex) |
|
||||
set_prestate(stmt_ann, expr_prestate(fcx.ccx, ex)) |
|
||||
|
||||
@@ -2255,7 +2255,7 @@ fn expr_is_lval(method_map: typeck::method_map, e: @ast::expr) -> bool {
|
||||
|
||||
fn stmt_node_id(s: @ast::stmt) -> ast::node_id {
|
||||
alt s.node {
|
||||
ast::stmt_decl(_, id) | stmt_expr(_, id) {
|
||||
ast::stmt_decl(_, id) | stmt_expr(_, id) | stmt_semi(_, id) {
|
||||
ret id;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1718,6 +1718,10 @@ fn check_stmt(fcx: @fn_ctxt, stmt: @ast::stmt) -> bool {
|
||||
}
|
||||
}
|
||||
ast::stmt_expr(expr, id) {
|
||||
node_id = id;
|
||||
bot = check_expr_with(fcx, expr, ty::mk_nil(fcx.ccx.tcx));
|
||||
}
|
||||
ast::stmt_semi(expr, id) {
|
||||
node_id = id;
|
||||
bot = check_expr(fcx, expr, none);
|
||||
}
|
||||
@@ -1749,7 +1753,7 @@ fn check_block(fcx0: @fn_ctxt, blk: ast::blk) -> bool {
|
||||
if bot && !warned &&
|
||||
alt s.node {
|
||||
ast::stmt_decl(@{node: ast::decl_local(_), _}, _) |
|
||||
ast::stmt_expr(_, _) {
|
||||
ast::stmt_expr(_, _) | ast::stmt_semi(_, _) {
|
||||
true
|
||||
}
|
||||
_ { false }
|
||||
|
||||
Reference in New Issue
Block a user