about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-08-29 16:50:06 -0700
committerPatrick Walton <pcwalton@mimiga.net>2011-08-29 16:50:06 -0700
commitf1ed03dfa5ae3460d64cb6032da790f04221a153 (patch)
treeb1709fc9a4abc708ecea8ba3c602b04560ed5e95
parent0a4d43379ead9ca3014ba71bb68b0db08e7e7e94 (diff)
downloadrust-f1ed03dfa5ae3460d64cb6032da790f04221a153.tar.gz
rust-f1ed03dfa5ae3460d64cb6032da790f04221a153.zip
rt: Have data::walk_fn be defensive regarding whether the derived implementation of walk_fn moves the data pointer
-rw-r--r--src/rt/rust_shape.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/rt/rust_shape.h b/src/rt/rust_shape.h
index 789d54c71fa..d8bb6b64c8f 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<T *>(this)->walk_fn(align);
-        dp += sizeof(void *) * 2;
+        dp = next_dp;
     }
 
     void walk_obj(bool align) {