Skip to content

Commit 6b562fa

Browse files
msullivanbrson
authored andcommitted
---
yaml --- r: 3371 b: refs/heads/master c: 8ad7f3b h: refs/heads/master i: 3369: 63a8ab3 3367: fda2127 v: v3
1 parent 749ec60 commit 6b562fa

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
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: 36fb7544761aed081c0dc5b5cf3f9d0267752e53
2+
refs/heads/master: 8ad7f3b56b79b13029384e51a201f495e0eb2a15

trunk/src/rt/rust_upcall.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,12 @@ upcall_vec_append(rust_task *task, type_desc *t, type_desc *elem_t,
478478
size_t n_dst_bytes = skip_null ? dst->fill - 1 : dst->fill;
479479
rust_vec *new_vec = vec_grow(task, dst, n_src_bytes, &need_copy, t);
480480

481+
// If src and dst are the same (due to "v += v"), then dst getting
482+
// resized causes src to move as well.
483+
if (dst == src) {
484+
src = new_vec;
485+
}
486+
481487
if (need_copy) {
482488
// Copy any dst elements in, omitting null if doing str.
483489
copy_elements(task, elem_t, &new_vec->data, &dst->data, n_dst_bytes);

0 commit comments

Comments
 (0)