Skip to content

Commit 797856c

Browse files
committed
Use unboxed vecs for string shape glue.
1 parent 88ec259 commit 797856c

File tree

5 files changed

+5
-12
lines changed

5 files changed

+5
-12
lines changed

src/rt/rust_shape.h

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ const uint8_t SHAPE_I64 = 7u;
4343
const uint8_t SHAPE_F32 = 8u;
4444
const uint8_t SHAPE_F64 = 9u;
4545
const uint8_t SHAPE_BOX = 10u;
46+
// FIXME: remove after snapshot (6/18/12)
4647
const uint8_t SHAPE_VEC = 11u;
4748
const uint8_t SHAPE_TAG = 12u;
4849
const uint8_t SHAPE_STRUCT = 17u;

src/rustc/middle/trans/shape.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ const shape_i64: u8 = 7u8;
7878
const shape_f32: u8 = 8u8;
7979
const shape_f64: u8 = 9u8;
8080
const shape_box: u8 = 10u8;
81-
const shape_vec: u8 = 11u8;
8281
const shape_enum: u8 = 12u8;
8382
const shape_struct: u8 = 17u8;
8483
const shape_box_fn: u8 = 18u8;
@@ -226,14 +225,7 @@ fn shape_of(ccx: @crate_ctxt, t: ty::t) -> [u8] {
226225
ty::ty_float(ast::ty_f64) { [shape_f64] }
227226
ty::ty_estr(ty::vstore_uniq) |
228227
ty::ty_str {
229-
// FIXME: we want to emit this as a unique pointer to an unboxed vec,
230-
// but it doesn't work at the moment, since trans doesn't put
231-
// tydescs in string boxes...
232-
let mut s = [shape_vec];
233-
add_bool(s, true); // type is POD
234-
let unit_ty = ty::mk_mach_uint(ccx.tcx, ast::ty_u8);
235-
add_substr(s, shape_of(ccx, unit_ty));
236-
s
228+
shape_of(ccx, tvec::expand_boxed_vec_ty(ccx.tcx, t))
237229
}
238230
ty::ty_enum(did, substs) {
239231
alt enum_kind(ccx, did) {

src/test/run-pass/log-knows-the-names-of-variants-in-std.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ fn check_log<T>(exp: str, v: T) {
1212

1313
fn main() {
1414
let x = list::from_vec([a(22u), b("hi")]);
15-
let exp = "@cons(a(22), @cons(b(\"hi\"), @nil))";
15+
let exp = "@cons(a(22), @cons(b(~\"hi\"), @nil))";
1616
assert #fmt["%?", x] == exp;
1717
check_log(exp, x);
1818
}

src/test/run-pass/log-knows-the-names-of-variants.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ enum foo {
66

77
fn main() {
88
assert "a(22)" == #fmt["%?", a(22u)];
9-
assert "b(\"hi\")" == #fmt["%?", b("hi")];
9+
assert "b(~\"hi\")" == #fmt["%?", b("hi")];
1010
assert "c" == #fmt["%?", c];
1111
}

src/test/run-pass/log-str.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
fn main() {
22
assert "~[1, 2, 3]" == sys::log_str([1, 2, 3]);
3-
assert #fmt["%?/%5?", [1, 2, 3], "hi"] == "~[1, 2, 3]/ \"hi\"";
3+
assert #fmt["%?/%6?", [1, 2, 3], "hi"] == "~[1, 2, 3]/ ~\"hi\"";
44
}

0 commit comments

Comments
 (0)