diff options
| author | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-01-30 21:00:57 -0800 |
|---|---|---|
| committer | Tim Chevalier <chevalier@alum.wellesley.edu> | 2012-01-31 10:08:24 -0800 |
| commit | fba35e1a3c87892823d1f4d436b9f00a7864cf16 (patch) | |
| tree | 1fadaaee99ef266bd2f709fb2aa5577184ab611e /src/comp/syntax/print | |
| parent | 813a55d89135efb716dd80e96453a091a7cfc631 (diff) | |
| download | rust-fba35e1a3c87892823d1f4d436b9f00a7864cf16.tar.gz rust-fba35e1a3c87892823d1f4d436b9f00a7864cf16.zip | |
Require alts to be exhaustive
middle::check_alt does the work. Lots of changes to add default cases into alts that were previously inexhaustive.
Diffstat (limited to 'src/comp/syntax/print')
| -rw-r--r-- | src/comp/syntax/print/pprust.rs | 33 |
1 files changed, 11 insertions, 22 deletions
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 */ } |
