From 98a63bd1f9fda47fc34b16d9f0782022e1022277 Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Wed, 1 Dec 2010 17:08:46 -0800 Subject: Add code to fail on non-exhaustive alt matching. Fix all cases this picked up in rustc. --- src/boot/me/trans.ml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/boot') 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 -- cgit v1.2.3