about summary refs log tree commit diff
path: root/src/rt/rust_shape.cpp
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2011-08-31 16:22:19 -0700
committerPatrick Walton <pcwalton@mimiga.net>2011-08-31 16:22:19 -0700
commitdc6f78561c238c472a6bab50eea36f4b3a39671d (patch)
treed899a00b92a63881f83b752984c05a3fda85dd4d /src/rt/rust_shape.cpp
parentdfcbfa61f3cbc331f4ab0ecf7fdd71b5faea773a (diff)
downloadrust-dc6f78561c238c472a6bab50eea36f4b3a39671d.tar.gz
rust-dc6f78561c238c472a6bab50eea36f4b3a39671d.zip
rt: Prevent trailing commas from showing up when logging oddly aligned arrays
Diffstat (limited to 'src/rt/rust_shape.cpp')
-rw-r--r--src/rt/rust_shape.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/rt/rust_shape.cpp b/src/rt/rust_shape.cpp
index a693684fa89..066bc1a115c 100644
--- a/src/rt/rust_shape.cpp
+++ b/src/rt/rust_shape.cpp
@@ -426,7 +426,7 @@ cmp::walk_variant(tag_info &tinfo, uint32_t variant_id,
 
 void
 log::walk_string(const std::pair<ptr,ptr> &data) {
-    out << "\"" << std::hex;
+    out << prefix << "\"" << std::hex;
 
     ptr subdp = data.first;
     while (subdp < data.second) {
@@ -443,7 +443,7 @@ log::walk_string(const std::pair<ptr,ptr> &data) {
 
 void
 log::walk_struct(const uint8_t *end_sp) {
-    out << "(";
+    out << prefix << "(";
 
     bool first = true;
     while (sp != end_sp) {
@@ -464,16 +464,15 @@ log::walk_vec(bool is_pod, const std::pair<ptr,ptr> &data) {
         return;
     }
 
-    out << "[";
+    out << prefix << "[";
 
     log sub(*this, data.first);
     sub.end_dp = data.second;
 
-    bool first = true;
     while (sub.dp < data.second) {
-        if (!first) out << ", ";
         sub.walk_reset();
-        sub.align = true, first = false;
+        sub.align = true;
+        sub.prefix = ", ";
     }
 
     out << "]";
@@ -500,7 +499,7 @@ log::walk_variant(tag_info &tinfo, uint32_t variant_id,
 void
 log::walk_res(const rust_fn *dtor, unsigned n_params,
               const type_param *params, const uint8_t *end_sp, bool live) {
-    out << "res";
+    out << prefix << "res";
 
     if (this->sp == end_sp)
         return;