Encode the istr shape correctly. Issue #855

This commit is contained in:
Brian Anderson 2011-08-22 16:12:42 -07:00
parent 6841f3827a
commit aae212727d
2 changed files with 13 additions and 2 deletions

View file

@ -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) {

View file

@ -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();
}