diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2011-06-16 16:08:26 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2011-06-16 16:08:26 -0700 |
| commit | 050f62983d68cc01ec3e0f81b04a7f4c45145555 (patch) | |
| tree | 156908acdf5bb727b3e0e40bbd5c28a5f8345b41 /src/rt | |
| parent | 94cd2985b267dd8462f2518c5d9109b4e0f71402 (diff) | |
| download | rust-050f62983d68cc01ec3e0f81b04a7f4c45145555.tar.gz rust-050f62983d68cc01ec3e0f81b04a7f4c45145555.zip | |
stdlib: Introduce an ivec module into the standard library; add a minimal test case
Diffstat (limited to 'src/rt')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 10 | ||||
| -rw-r--r-- | src/rt/rustrt.def.in | 1 |
2 files changed, 11 insertions, 0 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 2437a5c364d..892cdc0cb0b 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -606,6 +606,16 @@ ivec_reserve(rust_task *task, type_desc *ty, rust_ivec *v, size_t n_elems) v->alloc = new_alloc; } +/** + * Returns true if the given vector is on the heap and false if it's on the + * stack. + */ +extern "C" bool +ivec_on_heap(rust_task *task, type_desc *ty, rust_ivec *v) +{ + return !v->fill && v->payload.ptr; +} + // // Local Variables: diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in index ef0d5878ad8..13ab62fb29d 100644 --- a/src/rt/rustrt.def.in +++ b/src/rt/rustrt.def.in @@ -9,6 +9,7 @@ debug_trap debug_tydesc do_gc get_time +ivec_on_heap ivec_reserve last_os_error rand_free |
