File tree Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Expand file tree Collapse file tree 3 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -336,8 +336,9 @@ fn refcount(str s) -> uint {
336
336
if ( r == dbg:: const_refcount) {
337
337
ret r;
338
338
} else {
339
- // -1 because calling this function incremented the refcount.
340
- ret r - 1 u;
339
+ // -2 because calling this function and the native function both
340
+ // incremented the refcount.
341
+ ret r - 2 u;
341
342
}
342
343
}
343
344
Original file line number Diff line number Diff line change @@ -50,8 +50,9 @@ fn refcount[T](array[T] v) -> uint {
50
50
if ( r == dbg:: const_refcount) {
51
51
ret r;
52
52
} else {
53
- // -1 because calling this function incremented the refcount.
54
- ret r - 1 u;
53
+ // -2 because calling this function and the native function both
54
+ // incremented the refcount.
55
+ ret r - 2 u;
55
56
}
56
57
}
57
58
Original file line number Diff line number Diff line change 1
- // xfail-stage0
2
- // xfail-stage1
3
- // xfail-stage2
4
1
// -*- rust -*-
5
2
6
3
use std;
@@ -51,13 +48,13 @@ fn slow_growth2_helper(str s) { // ref up: s
51
48
* mumble, the existing str in the originally- shared vec.
52
49
*/
53
50
let vec[ str] v = [ mumble] ; // ref up: v, mumble
51
+ log vec:: refcount[ str] ( v) ;
54
52
let acc a = acc ( v) ; // ref up: a, v
55
53
56
54
log vec:: refcount[ str] ( v) ;
57
55
assert ( vec:: refcount[ str] ( v) == 2 u) ;
58
56
59
57
a. add ( s) ; // ref up: mumble, s. ref down: v
60
-
61
58
log vec:: refcount[ str] ( v) ;
62
59
log str:: refcount ( s) ;
63
60
log str:: refcount ( mumble) ;
You can’t perform that action at this time.
0 commit comments