提交 7d05bea7 编写于 作者: T Tim Chevalier

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)
上级 55e29ef4
...@@ -164,7 +164,8 @@ fn enter_opt(tcx: ty::ctxt, m: match, opt: opt, col: uint, ...@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册