Skip to content

Commit c89e642

Browse files
committed
---
yaml --- r: 2274 b: refs/heads/master c: 6daf440 h: refs/heads/master v: v3
1 parent 6d9985f commit c89e642

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-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: 3e08609ed7740f8aca9bded27b9bdda3591d84d7
2+
refs/heads/master: 6daf440037cb10baab332fde2b471712a3a42c76

trunk/src/comp/middle/trans.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7454,7 +7454,7 @@ fn trans_vec_append_glue(@local_ctxt cx) {
74547454
auto copy_src_cx = new_sub_block_ctxt(bcx, "copy new <- src");
74557455

74567456
auto pp0 = alloca(bcx, T_ptr(T_i8()));
7457-
bcx.build.Store(vec_p1(bcx, llnew_vec), pp0);
7457+
bcx.build.Store(vec_p1_adjusted(bcx, llnew_vec, llskipnull), pp0);
74587458
llvm.LLVMSetValueName(pp0, _str.buf("pp0"));
74597459

74607460
bcx.build.CondBr(bcx.build.TruncOrBitCast
@@ -7506,8 +7506,10 @@ fn trans_vec_append_glue(@local_ctxt cx) {
75067506
vec_p0(copy_dst_cx, lldst_vec),
75077507
n_bytes).bcx;
75087508

7509-
put_vec_fill(copy_dst_cx, llnew_vec, n_bytes);
7510-
copy_dst_cx.build.Store(vec_p1(copy_dst_cx, llnew_vec), pp0);
7509+
put_vec_fill(copy_dst_cx, llnew_vec, vec_fill(copy_dst_cx, lldst_vec));
7510+
7511+
copy_dst_cx.build.Store(vec_p1_adjusted(copy_dst_cx, llnew_vec,
7512+
llskipnull), pp0);
75117513
copy_dst_cx.build.Br(copy_src_cx.llbb);
75127514

75137515

@@ -7520,8 +7522,9 @@ fn trans_vec_append_glue(@local_ctxt cx) {
75207522
n_bytes).bcx;
75217523

75227524
put_vec_fill(copy_src_cx, llnew_vec,
7523-
copy_src_cx.build.Add(vec_fill(copy_src_cx,
7524-
llnew_vec),
7525+
copy_src_cx.build.Add(vec_fill_adjusted(copy_src_cx,
7526+
llnew_vec,
7527+
llskipnull),
75257528
n_bytes));
75267529

75277530
// Write new_vec back through the alias we were given.

trunk/src/test/run-pass/str-growth.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
fn main() {
2+
auto s = "a";
3+
s += "b";
4+
check (s.(0) == ('a' as u8));
5+
check (s.(1) == ('b' as u8));
6+
7+
s += "c";
8+
s += "d";
9+
check (s.(0) == ('a' as u8));
10+
check (s.(1) == ('b' as u8));
11+
check (s.(2) == ('c' as u8));
12+
check (s.(3) == ('d' as u8));
13+
}
14+

0 commit comments

Comments
 (0)