Skip to content

Commit 379d4bb

Browse files
committed
---
yaml --- r: 22476 b: refs/heads/master c: c84c4a8 h: refs/heads/master v: v3
1 parent e1c5f36 commit 379d4bb

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
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: 2ea9c8df0f7c9ee72913883128b37d0a80d2f4f6
2+
refs/heads/master: c84c4a8d71914b5bc0cb3546158bc053aacb7a96
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
55
refs/heads/try: ffbe0e0e00374358b789b0037bcb3a577cd218be

trunk/src/rustc/middle/check_const.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ fn check_item(sess: session, ast_map: ast_map::map, def_map: resolve::def_map,
3737

3838
fn check_pat(p: @pat, &&_is_const: bool, v: visit::vt<bool>) {
3939
fn is_str(e: @expr) -> bool {
40-
alt e.node { expr_lit(@{node: lit_str(_), _}) { true } _ { false } }
40+
alt e.node {
41+
expr_lit(@{node: lit_str(_), _}) |
42+
expr_vstore(@{node: expr_lit(@{node: lit_str(_), _}), _},
43+
vstore_uniq) { true }
44+
_ { false }
45+
}
4146
}
4247
alt p.node {
4348
// Let through plain string literals here

trunk/src/rustc/middle/const_eval.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ fn eval_const_expr(tcx: middle::ty::ctxt, e: @expr) -> const_val {
103103
}
104104
}
105105
expr_lit(lit) { lit_to_const(lit) }
106+
// If we have a vstore, just keep going; it has to be a string
107+
expr_vstore(e, _) { eval_const_expr(tcx, e) }
106108
}
107109
}
108110

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ fn trans_opt(bcx: block, o: opt) -> opt_result {
4747
alt o {
4848
lit(l) {
4949
alt l.node {
50-
ast::expr_lit(@{node: ast::lit_str(s), _}) {
50+
ast::expr_lit(@{node: ast::lit_str(s), _}) |
51+
ast::expr_vstore(@{node: ast::expr_lit(
52+
@{node: ast::lit_str(s), _}), _},
53+
ast::vstore_uniq) {
5154
let strty = ty::mk_str(bcx.tcx());
5255
let cell = empty_dest_cell();
5356
bcx = tvec::trans_estr(bcx, s, ast::vstore_uniq, by_val(cell));

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4613,7 +4613,9 @@ fn trans_enum_variant(ccx: @crate_ctxt, enum_id: ast::node_id,
46134613
fn trans_const_expr(cx: @crate_ctxt, e: @ast::expr) -> ValueRef {
46144614
let _icx = cx.insn_ctxt("trans_const_expr");
46154615
alt e.node {
4616-
ast::expr_lit(lit) { ret trans_crate_lit(cx, e, *lit); }
4616+
ast::expr_lit(lit) { trans_crate_lit(cx, e, *lit) }
4617+
// If we have a vstore, just keep going; it has to be a string
4618+
ast::expr_vstore(e, _) { trans_const_expr(cx, e) }
46174619
ast::expr_binary(b, e1, e2) {
46184620
let te1 = trans_const_expr(cx, e1);
46194621
let te2 = trans_const_expr(cx, e2);

0 commit comments

Comments
 (0)