Skip to content

Commit b504a36

Browse files
committed
---
yaml --- r: 988 b: refs/heads/master c: 98a63bd h: refs/heads/master v: v3
1 parent ef739f1 commit b504a36

File tree

7 files changed

+90
-15
lines changed

7 files changed

+90
-15
lines changed

[refs]

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: fd600bad4666758088ec69a355a0dbd86bb11c22
2+
refs/heads/master: 98a63bd1f9fda47fc34b16d9f0782022e1022277

trunk/src/boot/me/trans.ml

+8-1
Original file line numberDiff line numberDiff line change
@@ -4895,7 +4895,14 @@ let trans_visitor
48954895
last_jump
48964896
in
48974897
let last_jumps = Array.map trans_arm at.Ast.alt_tag_arms in
4898-
Array.iter patch last_jumps
4898+
if not (arr_exists
4899+
(fun _ arm -> (fst arm.node) = Ast.PAT_wild)
4900+
at.Ast.alt_tag_arms)
4901+
then
4902+
trans_cond_fail "non-exhaustive match failure"
4903+
(Array.to_list last_jumps)
4904+
else
4905+
Array.iter patch last_jumps
48994906

49004907
(* If we're about to drop a channel, synthesize an upcall_flush_chan.
49014908
* TODO: This should rather appear in a chan dtor when chans become

trunk/src/comp/front/parser.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ impure fn parse_bottom_expr(parser p) -> @ast.expr {
388388
es.node, ast.ann_none);
389389
hi = es.span;
390390
}
391+
case (_) { /* fall through */ }
391392
}
392393
}
393394

@@ -401,6 +402,7 @@ impure fn parse_bottom_expr(parser p) -> @ast.expr {
401402
ret @spanned(lo, hi,
402403
ast.expr_lit(lit, ast.ann_none));
403404
}
405+
case (_) { /* fall through */ }
404406
}
405407
auto e = parse_expr(p);
406408
hi = p.get_span();
@@ -590,6 +592,7 @@ impure fn parse_binops(parser p,
590592
more = true;
591593
}
592594
}
595+
case (_) { /* fall through */ }
593596
}
594597
}
595598
}
@@ -711,6 +714,7 @@ impure fn parse_assign_expr(parser p) -> @ast.expr {
711714
ret @spanned(lo, rhs.span,
712715
ast.expr_assign(lhs, rhs, ast.ann_none));
713716
}
717+
case (_) { /* fall through */ }
714718
}
715719
ret lhs;
716720
}
@@ -733,6 +737,7 @@ impure fn parse_if_expr(parser p) -> @ast.expr {
733737
els = some(eblk);
734738
hi = eblk.span;
735739
}
740+
case (_) { /* fall through */ }
736741
}
737742
ret @spanned(lo, hi, ast.expr_if(cond, thn, els, ast.ann_none));
738743
}
@@ -1039,6 +1044,7 @@ fn index_block(vec[@ast.stmt] stmts, option.t[@ast.expr] expr) -> ast.block_ {
10391044
}
10401045
}
10411046
}
1047+
case (_) { /* fall through */ }
10421048
}
10431049
}
10441050
ret rec(stmts=stmts, expr=expr, index=index);
@@ -1211,7 +1217,6 @@ impure fn parse_mod_items(parser p, token.token term) -> ast._mod {
12111217

12121218
case (ast.item_tag(?id, ?variants, _, _)) {
12131219
index.insert(id, ast.mie_item(u));
1214-
12151220
let uint variant_idx = 0u;
12161221
for (ast.variant v in variants) {
12171222
index.insert(v.name, ast.mie_tag_variant(u, variant_idx));

trunk/src/comp/middle/fold.rs

+20
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ type ast_fold[ENV] =
8686
(fn(&ENV e, &span sp,
8787
@ast.lit, ann a) -> @expr) fold_expr_lit,
8888

89+
(fn(&ENV e, &span sp,
90+
@ast.expr e, @ast.ty ty,
91+
ann a) -> @expr) fold_expr_cast,
92+
8993
(fn(&ENV e, &span sp,
9094
@expr cond, &block thn,
9195
&option.t[block] els,
@@ -296,11 +300,13 @@ fn fold_decl[ENV](&ENV env, ast_fold[ENV] fld, @decl d) -> @decl {
296300
case (some[@ast.ty](?t)) {
297301
ty_ = some[@ast.ty](fold_ty(env, fld, t));
298302
}
303+
case (_) { /* fall through */ }
299304
}
300305
alt (local.init) {
301306
case (some[@ast.expr](?e)) {
302307
init_ = some[@ast.expr](fold_expr(env, fld, e));
303308
}
309+
case (_) { /* fall through */ }
304310
}
305311
let @ast.local local_ = @rec(ty=ty_, init=init_ with *local);
306312
ret fld.fold_decl_local(env_, d.span, local_);
@@ -405,6 +411,12 @@ fn fold_expr[ENV](&ENV env, ast_fold[ENV] fld, &@expr e) -> @expr {
405411
ret fld.fold_expr_lit(env_, e.span, lit, t);
406412
}
407413

414+
case (ast.expr_cast(?e, ?t, ?at)) {
415+
auto ee = fold_expr(env_, fld, e);
416+
auto tt = fold_ty(env, fld, t);
417+
ret fld.fold_expr_cast(env_, e.span, ee, tt, at);
418+
}
419+
408420
case (ast.expr_if(?cnd, ?thn, ?els, ?t)) {
409421
auto ccnd = fold_expr(env_, fld, cnd);
410422
auto tthn = fold_block(env_, fld, thn);
@@ -413,6 +425,7 @@ fn fold_expr[ENV](&ENV env, ast_fold[ENV] fld, &@expr e) -> @expr {
413425
case (some[block](?b)) {
414426
eels = some(fold_block(env_, fld, b));
415427
}
428+
case (_) { /* fall through */ }
416429
}
417430
ret fld.fold_expr_if(env_, e.span, ccnd, tthn, eels, t);
418431
}
@@ -492,6 +505,7 @@ fn fold_stmt[ENV](&ENV env, ast_fold[ENV] fld, &@stmt s) -> @stmt {
492505
case (some[@expr](?e)) {
493506
oee = some(fold_expr(env_, fld, e));
494507
}
508+
case (_) { /* fall through */ }
495509
}
496510
ret fld.fold_stmt_ret(env_, s.span, oee);
497511
}
@@ -737,6 +751,11 @@ fn identity_fold_expr_lit[ENV](&ENV env, &span sp, @ast.lit lit,
737751
ret @respan(sp, ast.expr_lit(lit, a));
738752
}
739753

754+
fn identity_fold_expr_cast[ENV](&ENV env, &span sp, @ast.expr e,
755+
@ast.ty t, ann a) -> @expr {
756+
ret @respan(sp, ast.expr_cast(e, t, a));
757+
}
758+
740759
fn identity_fold_expr_if[ENV](&ENV env, &span sp,
741760
@expr cond, &block thn,
742761
&option.t[block] els, ann a) -> @expr {
@@ -956,6 +975,7 @@ fn new_identity_fold[ENV]() -> ast_fold[ENV] {
956975
fold_expr_binary = bind identity_fold_expr_binary[ENV](_,_,_,_,_,_),
957976
fold_expr_unary = bind identity_fold_expr_unary[ENV](_,_,_,_,_),
958977
fold_expr_lit = bind identity_fold_expr_lit[ENV](_,_,_,_),
978+
fold_expr_cast = bind identity_fold_expr_cast[ENV](_,_,_,_,_),
959979
fold_expr_if = bind identity_fold_expr_if[ENV](_,_,_,_,_,_),
960980
fold_expr_while = bind identity_fold_expr_while[ENV](_,_,_,_,_),
961981
fold_expr_do_while

trunk/src/comp/middle/resolve.rs

+1
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ fn lookup_name(&env e, ast.ident i) -> option.t[def] {
113113
case (some[uint](?ix)) {
114114
ret found_decl_stmt(b.node.stmts.(ix));
115115
}
116+
case (_) { /* fall through */ }
116117
}
117118
}
118119
}

trunk/src/comp/middle/trans.rs

+35-4
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ fn type_of_inner(@crate_ctxt cx, @typeck.ty t) -> TypeRef {
295295
case (ast.alias) {
296296
t = T_ptr(t);
297297
}
298+
case (_) { /* fall through */ }
298299
}
299300
atys += t;
300301
}
@@ -506,6 +507,17 @@ fn iter_structural_ty(@block_ctxt cx,
506507
i += 1;
507508
}
508509
}
510+
case (typeck.ty_rec(?fields)) {
511+
let int i = 0;
512+
for (typeck.field fld in fields) {
513+
auto llfld = r.bcx.build.GEP(v, vec(C_int(0), C_int(i)));
514+
r = f(r.bcx, llfld, fld.ty);
515+
i += 1;
516+
}
517+
}
518+
case (_) {
519+
cx.fcx.ccx.sess.unimpl("type in iter_structural_ty");
520+
}
509521
// FIXME: handle records and tags when we support them.
510522
}
511523
ret r;
@@ -560,6 +572,7 @@ fn iter_sequence(@block_ctxt cx,
560572
auto et = typeck.plain_ty(typeck.ty_machine(common.ty_u8));
561573
ret iter_sequence_body(cx, v, et, f, false);
562574
}
575+
case (_) { fail; }
563576
}
564577
cx.fcx.ccx.sess.bug("bad type in trans.iter_sequence");
565578
fail;
@@ -765,6 +778,7 @@ fn target_type(@crate_ctxt cx, @typeck.ty t) -> @typeck.ty {
765778
auto tm = typeck.ty_machine(cx.sess.get_targ_cfg().uint_type);
766779
ret @rec(struct=tm with *t);
767780
}
781+
case (_) { /* fall through */ }
768782
}
769783
ret t;
770784
}
@@ -813,8 +827,10 @@ impure fn trans_unary(@block_ctxt cx, ast.unop op,
813827
C_int(abi.box_rc_field_refcnt)));
814828
ret res(sub.bcx, cx.build.Store(C_int(1), rc));
815829
}
830+
case (_) {
831+
cx.fcx.ccx.sess.unimpl("expr variant in trans_unary");
832+
}
816833
}
817-
cx.fcx.ccx.sess.unimpl("expr variant in trans_unary");
818834
fail;
819835
}
820836

@@ -859,6 +875,8 @@ impure fn trans_binary(@block_ctxt cx, ast.binop op,
859875
ret join_results(cx, T_bool(),
860876
vec(lhs_true_res, rhs_res));
861877
}
878+
879+
case (_) { /* fall through */ }
862880
}
863881

864882
// Remaining cases are eager:
@@ -958,8 +976,11 @@ impure fn trans_binary(@block_ctxt cx, ast.binop op,
958976
sub.val = cx.build.ICmp(lib.llvm.LLVMIntSGT, lhs.val, sub.val);
959977
ret sub;
960978
}
979+
980+
case (_) {
981+
cx.fcx.ccx.sess.unimpl("operator in trans_binary");
982+
}
961983
}
962-
cx.fcx.ccx.sess.unimpl("expr variant in trans_binary");
963984
fail;
964985
}
965986

@@ -994,6 +1015,8 @@ fn join_results(@block_ctxt parent_cx,
9941015
// onward.
9951016
ret live.(0);
9961017
}
1018+
1019+
case (_) { /* fall through */ }
9971020
}
9981021

9991022
// We have >1 incoming edges. Make a join block and br+phi them into it.
@@ -1020,6 +1043,7 @@ impure fn trans_if(@block_ctxt cx, @ast.expr cond,
10201043
case (some[ast.block](?eblk)) {
10211044
else_res = trans_block(else_cx, eblk);
10221045
}
1046+
case (_) { /* fall through */ }
10231047
}
10241048

10251049
cond_res.bcx.build.CondBr(cond_res.val,
@@ -1119,8 +1143,8 @@ fn trans_field(@block_ctxt cx, &ast.span sp, @ast.expr base,
11191143
auto v = r.bcx.build.GEP(r.val, vec(C_int(0), C_int(ix as int)));
11201144
ret tup(res(r.bcx, v), lv._1);
11211145
}
1146+
case (_) { cx.fcx.ccx.sess.unimpl("field variant in trans_field"); }
11221147
}
1123-
cx.fcx.ccx.sess.unimpl("field variant in trans_field");
11241148
fail;
11251149
}
11261150

@@ -1132,8 +1156,8 @@ fn trans_lval(@block_ctxt cx, @ast.expr e) -> tup(result, bool) {
11321156
case (ast.expr_field(?base, ?ident, ?ann)) {
11331157
ret trans_field(cx, e.span, base, ident, ann);
11341158
}
1159+
case (_) { cx.fcx.ccx.sess.unimpl("expr variant in trans_lval"); }
11351160
}
1136-
cx.fcx.ccx.sess.unimpl("expr variant in trans_lval");
11371161
fail;
11381162
}
11391163

@@ -1366,6 +1390,7 @@ impure fn trans_ret(@block_ctxt cx, &option.t[@ast.expr] e) -> result {
13661390
case (some[@ast.expr](?x)) {
13671391
r = trans_expr(cx, x);
13681392
}
1393+
case (_) { /* fall through */ }
13691394
}
13701395

13711396
// Run all cleanups and back out.
@@ -1388,6 +1413,7 @@ impure fn trans_ret(@block_ctxt cx, &option.t[@ast.expr] e) -> result {
13881413
r.val = r.bcx.build.Ret(r.val);
13891414
ret r;
13901415
}
1416+
case (_) { /* fall through */ }
13911417
}
13921418

13931419
// FIXME: until LLVM has a unit type, we are moving around
@@ -1426,6 +1452,7 @@ impure fn trans_stmt(@block_ctxt cx, &ast.stmt s) -> result {
14261452
copy_ty(sub.bcx, true, llptr, sub.val,
14271453
typeck.expr_ty(e));
14281454
}
1455+
case (_) { /* fall through */ }
14291456
}
14301457
}
14311458
}
@@ -1496,8 +1523,10 @@ iter block_locals(&ast.block b) -> @ast.local {
14961523
case (ast.decl_local(?local)) {
14971524
put local;
14981525
}
1526+
case (_) { /* fall through */ }
14991527
}
15001528
}
1529+
case (_) { /* fall through */ }
15011530
}
15021531
}
15031532
}
@@ -1626,6 +1655,7 @@ impure fn trans_item(@crate_ctxt cx, &ast.item item) {
16261655
auto sub_cx = @rec(path=cx.path + "." + name with *cx);
16271656
trans_mod(sub_cx, m);
16281657
}
1658+
case (_) { /* fall through */ }
16291659
}
16301660
}
16311661

@@ -1650,6 +1680,7 @@ fn collect_item(&@crate_ctxt cx, @ast.item i) -> @crate_ctxt {
16501680
case (ast.item_mod(?name, ?m, ?mid)) {
16511681
cx.items.insert(mid, i);
16521682
}
1683+
case (_) { /* fall through */ }
16531684
}
16541685
ret cx;
16551686
}

0 commit comments

Comments
 (0)