@@ -33,13 +33,6 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
33
33
#[ inline]
34
34
pub unsafe fn forget < T > ( thing : T ) { intrinsics:: forget ( thing) ; }
35
35
36
- /**
37
- * Force-increment the reference count on a shared box. If used
38
- * carelessly, this can leak the box.
39
- */
40
- #[ inline]
41
- pub unsafe fn bump_box_refcount < T > ( t : @T ) { forget ( t) ; }
42
-
43
36
/**
44
37
* Transform a value of one type into a value of another type.
45
38
* Both types must have the same size and alignment.
@@ -106,7 +99,7 @@ pub unsafe fn copy_lifetime_vec<'a,S,T>(_ptr: &'a [S], ptr: &T) -> &'a T {
106
99
107
100
#[ cfg( test) ]
108
101
mod tests {
109
- use cast:: { bump_box_refcount , transmute} ;
102
+ use cast:: transmute;
110
103
use raw;
111
104
use realstd:: str:: StrAllocating ;
112
105
@@ -115,21 +108,6 @@ mod tests {
115
108
assert_eq ! ( 1 u, unsafe { :: cast:: transmute_copy( & 1 ) } ) ;
116
109
}
117
110
118
- #[ test]
119
- fn test_bump_managed_refcount ( ) {
120
- unsafe {
121
- let managed = @"box box box". to_owned ( ) ; // refcount 1
122
- bump_box_refcount ( managed) ; // refcount 2
123
- let ptr: * int = transmute ( managed) ; // refcount 2
124
- let _box1: @~str = :: cast:: transmute_copy ( & ptr) ;
125
- let _box2: @~str = :: cast:: transmute_copy ( & ptr) ;
126
- assert ! ( * _box1 == "box box box" . to_owned( ) ) ;
127
- assert ! ( * _box2 == "box box box" . to_owned( ) ) ;
128
- // Will destroy _box1 and _box2. Without the bump, this would
129
- // use-after-free. With too many bumps, it would leak.
130
- }
131
- }
132
-
133
111
#[ test]
134
112
fn test_transmute ( ) {
135
113
unsafe {
0 commit comments