Skip to content

Commit b0c1ac1

Browse files
committed
---
yaml --- r: 2751 b: refs/heads/master c: b620be9 h: refs/heads/master i: 2749: 781386f 2747: ce76a47 2743: b57707c 2735: 7bafdc6 2719: 3569053 2687: ce531ef v: v3
1 parent 44d53e7 commit b0c1ac1

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 2505a2312eeae17cbf261833af5c2cab40f698e2
2+
refs/heads/master: b620be9cd244368a3a0d354b0dec7e13b4b99527

trunk/src/comp/middle/typeck.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,31 @@ mod Pushdown {
13171317
auto t = Demand::autoderef(scx, e.span, expected,
13181318
ann_to_type(scx.fcx.ccx.tcx.node_types, ann), adk);
13191319
write::ty_only_fixup(scx, ann.id, t);
1320+
1321+
/* The following is a bit special-cased, but takes care of
1322+
the case where we say let @vec[whatever] v = @[]; */
1323+
auto inner_ty = t;
1324+
alt (uop) {
1325+
case (ast::box(?mut)) {
1326+
alt (struct(scx.fcx.ccx.tcx, t)) {
1327+
case (ty::ty_box(?inner)) { inner_ty = inner.ty; }
1328+
case (_) {
1329+
scx.fcx.ccx.tcx.sess.span_err(e.span,
1330+
"Expecting an application of box"
1331+
+ " to have a box type");
1332+
}
1333+
}
1334+
}
1335+
case (ast::deref) {
1336+
inner_ty = ty::mk_box(scx.fcx.ccx.tcx,
1337+
// maybe_mut should work because it'll unify with
1338+
// the existing type?
1339+
rec(ty=t, mut=ast::maybe_mut));
1340+
}
1341+
case (_) { inner_ty = strip_boxes(scx.fcx.ccx.tcx, t); }
1342+
}
1343+
1344+
pushdown_expr(scx, inner_ty, sube);
13201345
}
13211346
case (ast::expr_lit(?lit, ?ann)) {
13221347
auto t = Demand::simple(scx, e.span, expected,

trunk/src/test/compile-fail/vector-no-ann-2.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() -> () {
2+
let @vec[uint] quux = @[];
3+
}

0 commit comments

Comments
 (0)