Skip to content

Commit 4dae40f

Browse files
Jakub Wieczorekgraydon
authored andcommitted
---
yaml --- r: 38071 b: refs/heads/try c: 6530fd3 h: refs/heads/master i: 38069: d17c0a6 38067: 5375db8 38063: 9dab8f6 v: v3
1 parent d2528a3 commit 4dae40f

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 09bb07bed9166105ea961a42b5fff7739ae0d2e9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
5-
refs/heads/try: 1fdfd3b1d60b49a9f3c248781c7a82c617c55769
5+
refs/heads/try: 6530fd340119362e346f28c03e1efc772c18fbba
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/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)