From 7d05bea7b90a6963b48f761390fc6bc7ae2bb527 Mon Sep 17 00:00:00 2001 From: Tim Chevalier Date: Mon, 23 Apr 2012 15:50:51 -0700 Subject: [PATCH] Fix bug with * patterns in trans_alt enter_opt was handling the (*) case wrong and causing a bounds check failure. Fixed it (the test case is one of the extracted ones from the reference manual) --- src/rustc/middle/trans/alt.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rustc/middle/trans/alt.rs b/src/rustc/middle/trans/alt.rs index d79fb51e804..5b0f620661c 100644 --- a/src/rustc/middle/trans/alt.rs +++ b/src/rustc/middle/trans/alt.rs @@ -164,7 +164,8 @@ fn enter_opt(tcx: ty::ctxt, m: match, opt: opt, col: uint, alt p.node { ast::pat_enum(_, subpats) { if opt_eq(tcx, variant_opt(tcx, p.id), opt) { - some(option::get_or_default(subpats, [])) } + some(option::get_or_default(subpats, + vec::from_elem(variant_size, dummy))) } else { none } } ast::pat_ident(_, none) if pat_is_variant(tcx.def_map, p) { -- GitLab