aboutsummaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/_vec.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/lib/_vec.rs b/src/lib/_vec.rs
index 5f1d2baa..39dc8617 100644
--- a/src/lib/_vec.rs
+++ b/src/lib/_vec.rs
@@ -29,6 +29,11 @@ fn alloc[T](uint n_elts) -> vec[T] {
ret rustrt.vec_alloc[vec[T], T](n_elts);
}
+fn refcount[T](vec[T] v) -> uint {
+ // -1 because calling this function incremented the refcount.
+ ret rustrt.refcount[T](v) - 1u;
+}
+
type init_op[T] = fn(uint i) -> T;
fn init_fn[T](&init_op[T] op, uint n_elts) -> vec[T] {