about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-08-22 16:12:42 -0700
committerBrian Anderson <banderson@mozilla.com>2011-08-22 16:12:42 -0700
commitaae212727d40140181ca6f481b7e4bc75a64c796 (patch)
tree3e26e467f2b6ab1d45c90b5770efbd7f7d3f83bd
parent6841f3827a9d05c63699bfe94a7db66f4847e0c4 (diff)
downloadrust-aae212727d40140181ca6f481b7e4bc75a64c796.tar.gz
rust-aae212727d40140181ca6f481b7e4bc75a64c796.zip
Encode the istr shape correctly. Issue #855
-rw-r--r--src/comp/middle/shape.rs9
-rw-r--r--src/test/run-pass/istr.rs6
2 files changed, 13 insertions, 2 deletions
diff --git a/src/comp/middle/shape.rs b/src/comp/middle/shape.rs
index f3ada9b7ca4..fa15e7012b1 100644
--- a/src/comp/middle/shape.rs
+++ b/src/comp/middle/shape.rs
@@ -308,8 +308,13 @@ fn shape_of(ccx: &@crate_ctxt, t: ty::t) -> [u8] {
       ty::ty_str. {
         s += [shape_evec, 1u8, 1u8, 0u8, shape_u8];
       }
-      ty::ty_istr. { s += [shape_ivec, 1u8, 1u8, 0u8, shape_u8]; }
-
+      ty::ty_istr. {
+        s += [shape_ivec];
+        add_bool(s, true); // type is POD
+        let unit_ty = ty::mk_mach(ccx.tcx, ast::ty_u8);
+        add_size_hint(ccx, s, unit_ty);
+        add_substr(s, shape_of(ccx, unit_ty));
+      }
 
       ty::ty_tag(did, tps) {
         alt tag_kind(ccx, did) {
diff --git a/src/test/run-pass/istr.rs b/src/test/run-pass/istr.rs
index 2eef9399e8d..419a8cd9d73 100644
--- a/src/test/run-pass/istr.rs
+++ b/src/test/run-pass/istr.rs
@@ -16,8 +16,14 @@ fn test_heap_assign() {
     s = ~"AAAA";
 }
 
+fn test_heap_log() {
+    let s = ~"a big ol' string";
+    log s;
+}
+
 fn main() {
     test_stack_assign();
     test_heap_lit();
     test_heap_assign();
+    test_heap_log();
 }
\ No newline at end of file