@@ -526,8 +526,26 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
526526 }
527527 }
528528 ast::pat_vec(elts, tail) => {
529- let elt_type = match structure_of(fcx, pat.span, expected) {
530- ty::ty_evec(mt, _) | ty::ty_unboxed_vec(mt) => mt,
529+ let default_region_var =
530+ fcx.infcx().next_region_var_with_lb(
531+ pat.span, pcx.block_region
532+ );
533+
534+ let (elt_type, region_var) = match structure_of(
535+ fcx, pat.span, expected
536+ ) {
537+ ty::ty_evec(mt, vstore) => {
538+ let region_var = match vstore {
539+ ty::vstore_slice(r) => r,
540+ ty::vstore_box | ty::vstore_uniq | ty::vstore_fixed(_) => {
541+ default_region_var
542+ }
543+ };
544+ (mt, region_var)
545+ }
546+ ty::ty_unboxed_vec(mt) => {
547+ (mt, default_region_var)
548+ },
531549 _ => {
532550 tcx.sess.span_fatal(
533551 pat.span,
@@ -543,9 +561,6 @@ fn check_pat(pcx: pat_ctxt, pat: @ast::pat, expected: ty::t) {
543561
544562 match tail {
545563 Some ( tail_pat) => {
546- let region_var = fcx. infcx( ) . next_region_var_with_lb(
547- pat. span, pcx. block_region
548- ) ;
549564 let slice_ty = ty:: mk_evec( tcx,
550565 { ty: elt_type. ty, mutbl: elt_type. mutbl} ,
551566 ty:: vstore_slice( region_var)
0 commit comments