@@ -49,8 +49,8 @@ impl<T:Durable> LocalData for @T { }
49
49
impl Eq for @LocalData {
50
50
fn eq ( & self , other : & @LocalData ) -> bool {
51
51
unsafe {
52
- let ptr_a: ( uint , uint ) = cast:: reinterpret_cast ( & ( * self ) ) ;
53
- let ptr_b: ( uint , uint ) = cast:: reinterpret_cast ( other) ;
52
+ let ptr_a: & ( uint , uint ) = cast:: transmute ( self ) ;
53
+ let ptr_b: & ( uint , uint ) = cast:: transmute ( other) ;
54
54
return ptr_a == ptr_b;
55
55
}
56
56
}
@@ -68,7 +68,7 @@ fn cleanup_task_local_map(map_ptr: *libc::c_void) {
68
68
assert ! ( !map_ptr. is_null( ) ) ;
69
69
// Get and keep the single reference that was created at the
70
70
// beginning.
71
- let _map: TaskLocalMap = cast:: reinterpret_cast ( & map_ptr) ;
71
+ let _map: TaskLocalMap = cast:: transmute ( map_ptr) ;
72
72
// All local_data will be destroyed along with the map.
73
73
}
74
74
}
@@ -125,14 +125,9 @@ unsafe fn get_newsched_local_map(local: *mut LocalStorage) -> TaskLocalMap {
125
125
& LocalStorage ( ref mut map_ptr, ref mut at_exit) => {
126
126
assert ! ( ( * map_ptr) . is_null( ) ) ;
127
127
let map: TaskLocalMap = @mut ~[ ] ;
128
- // Use reinterpret_cast -- transmute would take map away from us also.
129
- * map_ptr = cast:: reinterpret_cast ( & map) ;
128
+ * map_ptr = cast:: transmute ( map) ;
130
129
let at_exit_fn: ~fn ( * libc:: c_void ) = |p|cleanup_task_local_map ( p) ;
131
130
* at_exit = Some ( at_exit_fn) ;
132
- // Also need to reference it an extra time to keep it for now.
133
- let nonmut = cast:: transmute :: < TaskLocalMap ,
134
- @~[ Option < TaskLocalElement > ] > ( map) ;
135
- cast:: bump_box_refcount ( nonmut) ;
136
131
return map;
137
132
}
138
133
}
@@ -143,7 +138,7 @@ unsafe fn key_to_key_value<T:Durable>(
143
138
144
139
// Keys are closures, which are (fnptr,envptr) pairs. Use fnptr.
145
140
// Use reintepret_cast -- transmute would leak (forget) the closure.
146
- let pair: ( * libc:: c_void , * libc:: c_void ) = cast:: reinterpret_cast ( & key) ;
141
+ let pair: ( * libc:: c_void , * libc:: c_void ) = cast:: transmute ( key) ;
147
142
pair. first ( )
148
143
}
149
144
@@ -213,7 +208,7 @@ pub unsafe fn local_set<T:Durable>(
213
208
// own on it can be dropped when the box is destroyed. The unsafe pointer
214
209
// does not have a reference associated with it, so it may become invalid
215
210
// when the box is destroyed.
216
- let data_ptr = cast:: reinterpret_cast ( & data) ;
211
+ let data_ptr = * cast:: transmute :: < & @ T , & * libc :: c_void > ( & data) ;
217
212
let data_box = @data as @LocalData ;
218
213
// Construct new entry to store in the map.
219
214
let new_entry = Some ( ( keyval, data_ptr, data_box) ) ;
0 commit comments