Skip to content

Commit 5144f79

Browse files
committed
Fix and un-xfail vec-append test
1 parent 75ffe65 commit 5144f79

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

src/lib/str.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,9 @@ fn refcount(str s) -> uint {
336336
if (r == dbg::const_refcount) {
337337
ret r;
338338
} else {
339-
// -1 because calling this function incremented the refcount.
340-
ret r - 1u;
339+
// -2 because calling this function and the native function both
340+
// incremented the refcount.
341+
ret r - 2u;
341342
}
342343
}
343344

src/lib/vec.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ fn refcount[T](array[T] v) -> uint {
5050
if (r == dbg::const_refcount) {
5151
ret r;
5252
} else {
53-
// -1 because calling this function incremented the refcount.
54-
ret r - 1u;
53+
// -2 because calling this function and the native function both
54+
// incremented the refcount.
55+
ret r - 2u;
5556
}
5657
}
5758

src/test/run-pass/vec-append.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
// xfail-stage0
2-
// xfail-stage1
3-
// xfail-stage2
41
// -*- rust -*-
52

63
use std;
@@ -51,13 +48,13 @@ fn slow_growth2_helper(str s) { // ref up: s
5148
* mumble, the existing str in the originally- shared vec.
5249
*/
5350
let vec[str] v = [mumble]; // ref up: v, mumble
51+
log vec::refcount[str](v);
5452
let acc a = acc(v); // ref up: a, v
5553

5654
log vec::refcount[str](v);
5755
assert (vec::refcount[str](v) == 2u);
5856

5957
a.add(s); // ref up: mumble, s. ref down: v
60-
6158
log vec::refcount[str](v);
6259
log str::refcount(s);
6360
log str::refcount(mumble);

0 commit comments

Comments
 (0)