Skip to content

Commit f1ed03d

Browse files
committed
rt: Have data::walk_fn be defensive regarding whether the derived implementation of walk_fn moves the data pointer
1 parent 0a4d433 commit f1ed03d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/rt/rust_shape.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,8 +775,9 @@ class data : public ctxt< data<T,U> > {
775775

776776
void walk_fn(bool align) {
777777
if (align) dp = align_to(dp, sizeof(void *));
778+
U next_dp = dp + sizeof(void *) * 2;
778779
static_cast<T *>(this)->walk_fn(align);
779-
dp += sizeof(void *) * 2;
780+
dp = next_dp;
780781
}
781782

782783
void walk_obj(bool align) {

0 commit comments

Comments
 (0)