diff options
| author | Graydon Hoare <[email protected]> | 2010-12-01 17:08:46 -0800 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-12-01 17:09:02 -0800 |
| commit | 98a63bd1f9fda47fc34b16d9f0782022e1022277 (patch) | |
| tree | 25796c068e3219553a6b7e984d512523ddd754cf /src/boot | |
| parent | rustc: Annotate variants with their types. This may be useful for trans! (diff) | |
| download | rust-98a63bd1f9fda47fc34b16d9f0782022e1022277.tar.xz rust-98a63bd1f9fda47fc34b16d9f0782022e1022277.zip | |
Add code to fail on non-exhaustive alt matching. Fix all cases this picked up in rustc.
Diffstat (limited to 'src/boot')
| -rw-r--r-- | src/boot/me/trans.ml | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/boot/me/trans.ml b/src/boot/me/trans.ml index 58cccb99..34f4d81d 100644 --- a/src/boot/me/trans.ml +++ b/src/boot/me/trans.ml @@ -4895,7 +4895,14 @@ let trans_visitor last_jump in let last_jumps = Array.map trans_arm at.Ast.alt_tag_arms in - Array.iter patch last_jumps + if not (arr_exists + (fun _ arm -> (fst arm.node) = Ast.PAT_wild) + at.Ast.alt_tag_arms) + then + trans_cond_fail "non-exhaustive match failure" + (Array.to_list last_jumps) + else + Array.iter patch last_jumps (* If we're about to drop a channel, synthesize an upcall_flush_chan. * TODO: This should rather appear in a chan dtor when chans become |