Skip to content

Commit 75471cb

Browse files
committed
---
yaml --- r: 2907 b: refs/heads/master c: 5144f79 h: refs/heads/master i: 2905: 838a9d5 2903: 4e482a8 v: v3
1 parent 4487740 commit 75471cb

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: 75ffe657dbd202cf22175f0234e80f4e09c5d499
2+
refs/heads/master: 5144f790fe7c57224ba164ca0ecc81cfcc4ddd20

trunk/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

trunk/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

trunk/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)