diff options
| author | Michael Sullivan <sully@msully.net> | 2012-06-18 13:16:38 -0700 |
|---|---|---|
| committer | Michael Sullivan <sully@msully.net> | 2012-06-18 15:54:37 -0700 |
| commit | 88ec259cee17df6b78ce52b966148f0e03f02270 (patch) | |
| tree | 2d376e640e83a57071030c89c9fc9d3a478a0855 /src/rt/rust_util.cpp | |
| parent | b4484d51c14ec3b70ed8d4b6700bc3536a3ee766 (diff) | |
| download | rust-88ec259cee17df6b78ce52b966148f0e03f02270.tar.gz rust-88ec259cee17df6b78ce52b966148f0e03f02270.zip | |
Put type descriptors in strings created by the runtime. Progress on #2638.
Diffstat (limited to 'src/rt/rust_util.cpp')
| -rw-r--r-- | src/rt/rust_util.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/rt/rust_util.cpp b/src/rt/rust_util.cpp new file mode 100644 index 00000000000..07f89ece662 --- /dev/null +++ b/src/rt/rust_util.cpp @@ -0,0 +1,43 @@ +#include "rust_type.h" +#include "rust_shape.h" + + +// A hardcoded type descriptor for strings, since the runtime needs to +// be able to create them. + +struct rust_shape_tables empty_shape_tables; + +uint8_t str_body_shape[] = { + shape::SHAPE_UNBOXED_VEC, + 0x1, // is_pod + 0x1, 0x0, // size field: 1 + shape::SHAPE_U8 +}; + +struct type_desc str_body_tydesc = { + 0, // unused + 1, // size + 1, // align + NULL, // take_glue + NULL, // drop_glue + NULL, // free_glue + NULL, // visit_glue + 0, // unused + 0, // unused + 0, // unused + 0, // unused + str_body_shape, // shape + &empty_shape_tables, // shape_tables + 0, // unused + 0, // unused +}; + +// +// Local Variables: +// mode: C++ +// fill-column: 78; +// indent-tabs-mode: nil +// c-basic-offset: 4 +// buffer-file-coding-system: utf-8-unix +// End: +// |
