From 974092c5265ac6ed500bdf277412461f092fda96 Mon Sep 17 00:00:00 2001 From: Roy Frostig Date: Fri, 3 Sep 2010 16:25:56 -0700 Subject: Test multi-ref'ed vec growth more seriously than before. --- src/lib/_vec.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/lib') 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] { -- cgit v1.2.3