From fba35e1a3c87892823d1f4d436b9f00a7864cf16 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Mon, 30 Jan 2012 21:00:57 -0800 Subject: Require alts to be exhaustive middle::check_alt does the work. Lots of changes to add default cases into alts that were previously inexhaustive. --- src/comp/syntax/print/pprust.rs | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'src/comp/syntax/print/pprust.rs') diff --git a/src/comp/syntax/print/pprust.rs b/src/comp/syntax/print/pprust.rs index c361beb21ce..fbfa5f4f433 100644 --- a/src/comp/syntax/print/pprust.rs +++ b/src/comp/syntax/print/pprust.rs @@ -336,17 +336,6 @@ fn print_type(s: ps, &&ty: @ast::ty) { word(s.s, "]"); } ast::ty_ptr(mt) { word(s.s, "*"); print_mt(s, mt); } - ast::ty_task { word(s.s, "task"); } - ast::ty_port(t) { - word(s.s, "port<"); - print_type(s, t); - word(s.s, ">"); - } - ast::ty_chan(t) { - word(s.s, "chan<"); - print_type(s, t); - word(s.s, ">"); - } ast::ty_rec(fields) { word(s.s, "{"); fn print_field(s: ps, f: ast::ty_field) { @@ -370,12 +359,18 @@ fn print_type(s: ps, &&ty: @ast::ty) { print_ty_fn(s, some(proto), d, none, none); } ast::ty_path(path, _) { print_path(s, path, false); } - ast::ty_type { word(s.s, "type"); } ast::ty_constr(t, cs) { print_type(s, t); space(s.s); word(s.s, ast_ty_constrs_str(cs)); } + ast::ty_mac(_) { + fail "print_type doesn't know how to print a ty_mac"; + } + ast::ty_infer { + fail "print_type shouldn't see a ty_infer"; + } + } end(s); } @@ -703,11 +698,6 @@ fn print_if(s: ps, test: @ast::expr, blk: ast::blk, alt els { some(_else) { alt _else.node { - - - - - // "another else-if" ast::expr_if(i, t, e) { cbox(s, indent_unit - 1u); @@ -718,11 +708,6 @@ fn print_if(s: ps, test: @ast::expr, blk: ast::blk, print_block(s, t); do_else(s, e); } - - - - - // "final else" ast::expr_block(b) { cbox(s, indent_unit - 1u); @@ -730,6 +715,10 @@ fn print_if(s: ps, test: @ast::expr, blk: ast::blk, word(s.s, " else "); print_block(s, b); } + // BLEAH, constraints would be great here + _ { + fail "print_if saw if with weird alternative"; + } } } _ {/* fall through */ } -- cgit 1.4.1-3-g733a5