Skip to content

Commit 1496e43

Browse files
committed
---
yaml --- r: 11683 b: refs/heads/master c: 7b81cd8 h: refs/heads/master i: 11681: 5e7eb4b 11679: e76fc25 v: v3
1 parent 3fecbf9 commit 1496e43

File tree

3 files changed

+7
-19
lines changed

3 files changed

+7
-19
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: e55d7d6add5f7a2ae8e8eb164574ecec8b870a86
2+
refs/heads/master: 7b81cd8930079684d8b66bd7086931c969ef43a3
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/rustc/middle/trans/alt.rs

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,9 @@ fn extract_variant_args(bcx: block, pat_id: ast::node_id,
258258
vdefs: {enm: def_id, var: def_id}, val: ValueRef) ->
259259
{vals: [ValueRef], bcx: block} {
260260
let ccx = bcx.fcx.ccx, bcx = bcx;
261-
// invariant:
262-
// pat_id must have the same length ty_param_substs as vdefs?
263-
let ty_param_substs = node_id_type_params(bcx, pat_id);
261+
let enum_ty_substs = alt check ty::get(node_id_type(bcx, pat_id)).struct {
262+
ty::ty_enum(id, tps) { assert id == vdefs.enm; tps }
263+
};
264264
let blobptr = val;
265265
let variants = ty::enum_variants(ccx.tcx, vdefs.enm);
266266
let args = [];
@@ -275,12 +275,8 @@ fn extract_variant_args(bcx: block, pat_id: ast::node_id,
275275
let vdefs_tg = vdefs.enm;
276276
let vdefs_var = vdefs.var;
277277
while i < size {
278-
let r =
279-
// invariant needed:
280-
// how do we know it even makes sense to pass in ty_param_substs
281-
// here? What if it's [] and the enum type has variables in it?
282-
GEP_enum(bcx, blobptr, vdefs_tg, vdefs_var,
283-
ty_param_substs, i);
278+
let r = GEP_enum(bcx, blobptr, vdefs_tg, vdefs_var,
279+
enum_ty_substs, i);
284280
bcx = r.bcx;
285281
args += [r.val];
286282
i += 1u;

trunk/src/rustc/middle/typeck.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1445,15 +1445,7 @@ fn check_pat(fcx: @fn_ctxt, map: pat_util::pat_id_map, pat: @ast::pat,
14451445
let tcx = fcx.ccx.tcx;
14461446
alt pat.node {
14471447
ast::pat_wild {
1448-
alt structure_of(fcx, pat.span, expected) {
1449-
ty::ty_enum(_, expected_tps) {
1450-
write_ty_substs(tcx, pat.id, expected,
1451-
expected_tps);
1452-
}
1453-
_ {
1454-
write_ty(tcx, pat.id, expected);
1455-
}
1456-
}
1448+
write_ty(tcx, pat.id, expected);
14571449
}
14581450
ast::pat_lit(lt) {
14591451
check_expr_with(fcx, lt, expected);

0 commit comments

Comments
 (0)