Fix and un-xfail vec-append test

This commit is contained in:
Marijn Haverbeke 2011-06-02 16:45:26 +02:00
parent 75ffe657db
commit 5144f790fe
3 changed files with 7 additions and 8 deletions

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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);