aboutsummaryrefslogtreecommitdiff
path: root/src/lib/_vec.rs
diff options
context:
space:
mode:
authorRoy Frostig <[email protected]>2010-09-03 16:25:56 -0700
committerRoy Frostig <[email protected]>2010-09-03 16:25:56 -0700
commit974092c5265ac6ed500bdf277412461f092fda96 (patch)
tree270bc6d8fc07a7e447fa5e741c9bb425ccc05d94 /src/lib/_vec.rs
parentWhen vec growth results in a newly allocated (extended) buffer, copy existing... (diff)
downloadrust-974092c5265ac6ed500bdf277412461f092fda96.tar.xz
rust-974092c5265ac6ed500bdf277412461f092fda96.zip
Test multi-ref'ed vec growth more seriously than before.
Diffstat (limited to 'src/lib/_vec.rs')
-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] {