1
Fork 0

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)
This commit is contained in:
Tim Chevalier 2012-04-23 15:50:51 -07:00
parent 55e29ef4aa
commit 7d05bea7b9

View file

@ -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) {