Skip to content

Commit 8e23e9d

Browse files
Jakub Wieczorekgraydon
authored andcommitted
---
yaml --- r: 34178 b: refs/heads/snap-stage3 c: 6530fd3 h: refs/heads/master v: v3
1 parent cb9f300 commit 8e23e9d

File tree

2 files changed

+21
-6
lines changed
  • branches/snap-stage3/src/librustc/middle/typeck/check

2 files changed

+21
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 1fdfd3b1d60b49a9f3c248781c7a82c617c55769
4+
refs/heads/snap-stage3: 6530fd340119362e346f28c03e1efc772c18fbba
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/librustc/middle/typeck/check/alt.rs

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)