Skip to content

Commit 3f8223f

Browse files
committed
rt: Fix vec_from_buf_shared for new vecs
1 parent ecd4318 commit 3f8223f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/rt/rust_builtin.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,14 +157,15 @@ str_reserve_shared(rust_vec_box** sp,
157157
* Copies elements in an unsafe buffer to the given interior vector. The
158158
* vector must have size zero.
159159
*/
160-
extern "C" CDECL rust_vec*
160+
extern "C" CDECL rust_vec_box*
161161
vec_from_buf_shared(type_desc *ty, void *ptr, size_t count) {
162162
rust_task *task = rust_get_current_task();
163163
size_t fill = ty->size * count;
164-
rust_vec* v = (rust_vec*)task->kernel->malloc(fill + sizeof(rust_vec),
165-
"vec_from_buf");
166-
v->fill = v->alloc = fill;
167-
memmove(&v->data[0], ptr, fill);
164+
rust_vec_box* v = (rust_vec_box*)
165+
task->kernel->malloc(fill + sizeof(rust_vec_box),
166+
"vec_from_buf");
167+
v->body.fill = v->body.alloc = fill;
168+
memmove(&v->body.data[0], ptr, fill);
168169
return v;
169170
}
170171

0 commit comments

Comments
 (0)