From f1ed03dfa5ae3460d64cb6032da790f04221a153 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Mon, 29 Aug 2011 16:50:06 -0700 Subject: [PATCH] rt: Have data::walk_fn be defensive regarding whether the derived implementation of walk_fn moves the data pointer --- src/rt/rust_shape.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/rt/rust_shape.h b/src/rt/rust_shape.h index 789d54c71fa9..d8bb6b64c8ff 100644 --- a/src/rt/rust_shape.h +++ b/src/rt/rust_shape.h @@ -775,8 +775,9 @@ public: void walk_fn(bool align) { if (align) dp = align_to(dp, sizeof(void *)); + U next_dp = dp + sizeof(void *) * 2; static_cast(this)->walk_fn(align); - dp += sizeof(void *) * 2; + dp = next_dp; } void walk_obj(bool align) {