about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-06-02 16:45:26 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-06-02 16:45:26 +0200
commit5144f790fe7c57224ba164ca0ecc81cfcc4ddd20 (patch)
treee728d419107cba6225e046d6150836f40fb8fe83 /src
parent75ffe657dbd202cf22175f0234e80f4e09c5d499 (diff)
downloadrust-5144f790fe7c57224ba164ca0ecc81cfcc4ddd20.tar.gz
rust-5144f790fe7c57224ba164ca0ecc81cfcc4ddd20.zip
Fix and un-xfail vec-append test
Diffstat (limited to 'src')
-rw-r--r--src/lib/str.rs5
-rw-r--r--src/lib/vec.rs5
-rw-r--r--src/test/run-pass/vec-append.rs5
3 files changed, 7 insertions, 8 deletions
diff --git a/src/lib/str.rs b/src/lib/str.rs
index 388ed3d5825..9df30a38587 100644
--- a/src/lib/str.rs
+++ b/src/lib/str.rs
@@ -336,8 +336,9 @@ fn refcount(str s) -> uint {
     if (r == dbg::const_refcount) {
         ret r;
     } else {
-        // -1 because calling this function incremented the refcount.
-        ret  r - 1u;
+        // -2 because calling this function and the native function both
+        // incremented the refcount.
+        ret  r - 2u;
     }
 }
 
diff --git a/src/lib/vec.rs b/src/lib/vec.rs
index 3815031b305..969fca9a17e 100644
--- a/src/lib/vec.rs
+++ b/src/lib/vec.rs
@@ -50,8 +50,9 @@ fn refcount[T](array[T] v) -> uint {
     if (r == dbg::const_refcount) {
         ret r;
     } else {
-        // -1 because calling this function incremented the refcount.
-        ret  r - 1u;
+        // -2 because calling this function and the native function both
+        // incremented the refcount.
+        ret  r - 2u;
     }
 }
 
diff --git a/src/test/run-pass/vec-append.rs b/src/test/run-pass/vec-append.rs
index 46b0cd6f2a1..f7404852063 100644
--- a/src/test/run-pass/vec-append.rs
+++ b/src/test/run-pass/vec-append.rs
@@ -1,6 +1,3 @@
-// xfail-stage0
-// xfail-stage1
-// xfail-stage2
 // -*- rust -*-
 
 use std;
@@ -51,13 +48,13 @@ fn slow_growth2_helper(str s) {   // ref up: s
      * mumble, the existing str in the originally- shared vec.
      */
     let vec[str] v = [mumble]; // ref up: v, mumble
+    log vec::refcount[str](v);
     let acc a = acc(v);           // ref up: a, v
 
     log vec::refcount[str](v);
     assert (vec::refcount[str](v) == 2u);
 
     a.add(s);                     // ref up: mumble, s.  ref down: v
-
     log vec::refcount[str](v);
     log str::refcount(s);
     log str::refcount(mumble);