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:
@@ -164,7 +164,8 @@ fn enter_opt(tcx: ty::ctxt, m: match, opt: opt, col: uint,
|
|||||||
alt p.node {
|
alt p.node {
|
||||||
ast::pat_enum(_, subpats) {
|
ast::pat_enum(_, subpats) {
|
||||||
if opt_eq(tcx, variant_opt(tcx, p.id), opt) {
|
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 }
|
else { none }
|
||||||
}
|
}
|
||||||
ast::pat_ident(_, none) if pat_is_variant(tcx.def_map, p) {
|
ast::pat_ident(_, none) if pat_is_variant(tcx.def_map, p) {
|
||||||
|
|||||||
Reference in New Issue
Block a user