diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2011-04-27 18:10:02 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2011-04-27 18:14:56 -0700 |
| commit | 180a389832ea505df5a05620a35fcfc4ba311936 (patch) | |
| tree | f021ab47aee5cee988b7d8ec0b523dc4dc84a37e /src/rt/rust_builtin.cpp | |
| parent | e3fa22ab13b13db460eaa33df1c52245242d1275 (diff) | |
| download | rust-180a389832ea505df5a05620a35fcfc4ba311936.tar.gz rust-180a389832ea505df5a05620a35fcfc4ba311936.zip | |
stdlib/rt: Add an unsafe function to cast immutable vectors to mutable ones
Diffstat (limited to 'src/rt/rust_builtin.cpp')
| -rw-r--r-- | src/rt/rust_builtin.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp index 5566835d3cd..a232389812a 100644 --- a/src/rt/rust_builtin.cpp +++ b/src/rt/rust_builtin.cpp @@ -178,6 +178,15 @@ vec_from_vbuf(rust_task *task, type_desc *ty, void *vbuf, size_t n_elts) vbuf); } +extern "C" CDECL rust_vec* +unsafe_vec_to_mut(rust_task *task, type_desc *ty, rust_vec *v) +{ + if (v->ref_count != CONST_REFCOUNT) { + v->ref(); + } + return v; +} + extern "C" CDECL rust_str* str_alloc(rust_task *task, size_t n_bytes) { |
