@@ -86,11 +86,11 @@ pub unsafe fn position<T>(buf: *T, f: &fn(&T) -> bool) -> uint {
8686
8787/// Create an unsafe null pointer
8888#[ inline( always) ]
89- pub fn null < T > ( ) -> * T { unsafe { cast:: reinterpret_cast ( & 0 u) } }
89+ pub fn null < T > ( ) -> * T { unsafe { cast:: transmute ( 0 u) } }
9090
9191/// Create an unsafe mutable null pointer
9292#[ inline( always) ]
93- pub fn mut_null < T > ( ) -> * mut T { unsafe { cast:: reinterpret_cast ( & 0 u) } }
93+ pub fn mut_null < T > ( ) -> * mut T { unsafe { cast:: transmute ( 0 u) } }
9494
9595/// Returns true if the pointer is equal to the null pointer.
9696#[ inline( always) ]
@@ -134,7 +134,7 @@ pub unsafe fn set_memory<T>(dst: *mut T, c: int, count: uint) {
134134*/
135135#[ inline( always) ]
136136pub fn to_unsafe_ptr < T > ( thing : & T ) -> * T {
137- unsafe { cast:: reinterpret_cast ( & thing) }
137+ unsafe { cast:: transmute ( thing) }
138138}
139139
140140/**
@@ -144,7 +144,7 @@ pub fn to_unsafe_ptr<T>(thing: &T) -> *T {
144144*/
145145#[ inline( always) ]
146146pub fn to_const_unsafe_ptr < T > ( thing : & const T ) -> * const T {
147- unsafe { cast:: reinterpret_cast ( & thing) }
147+ unsafe { cast:: transmute ( thing) }
148148}
149149
150150/**
@@ -154,7 +154,7 @@ pub fn to_const_unsafe_ptr<T>(thing: &const T) -> *const T {
154154*/
155155#[ inline( always) ]
156156pub fn to_mut_unsafe_ptr < T > ( thing : & mut T ) -> * mut T {
157- unsafe { cast:: reinterpret_cast ( & thing) }
157+ unsafe { cast:: transmute ( thing) }
158158}
159159
160160/**
@@ -167,7 +167,7 @@ pub fn to_mut_unsafe_ptr<T>(thing: &mut T) -> *mut T {
167167#[ inline( always) ]
168168pub fn to_uint < T > ( thing : & T ) -> uint {
169169 unsafe {
170- cast:: reinterpret_cast ( & thing)
170+ cast:: transmute ( thing)
171171 }
172172}
173173
@@ -259,8 +259,8 @@ impl<T> Eq for *const T {
259259 #[inline(always)]
260260 fn eq(&self, other: &*const T) -> bool {
261261 unsafe {
262- let a: uint = cast::reinterpret_cast(&( *self) );
263- let b: uint = cast::reinterpret_cast(&( *other) );
262+ let a: uint = cast::transmute( *self);
263+ let b: uint = cast::transmute( *other);
264264 return a == b;
265265 }
266266 }
@@ -274,32 +274,32 @@ impl<T> Ord for *const T {
274274 #[inline(always)]
275275 fn lt(&self, other: &*const T) -> bool {
276276 unsafe {
277- let a: uint = cast::reinterpret_cast(&( *self) );
278- let b: uint = cast::reinterpret_cast(&( *other) );
277+ let a: uint = cast::transmute( *self);
278+ let b: uint = cast::transmute( *other);
279279 return a < b;
280280 }
281281 }
282282 #[inline(always)]
283283 fn le(&self, other: &*const T) -> bool {
284284 unsafe {
285- let a: uint = cast::reinterpret_cast(&( *self) );
286- let b: uint = cast::reinterpret_cast(&( *other) );
285+ let a: uint = cast::transmute( *self);
286+ let b: uint = cast::transmute( *other);
287287 return a <= b;
288288 }
289289 }
290290 #[inline(always)]
291291 fn ge(&self, other: &*const T) -> bool {
292292 unsafe {
293- let a: uint = cast::reinterpret_cast(&( *self) );
294- let b: uint = cast::reinterpret_cast(&( *other) );
293+ let a: uint = cast::transmute( *self);
294+ let b: uint = cast::transmute( *other);
295295 return a >= b;
296296 }
297297 }
298298 #[inline(always)]
299299 fn gt(&self, other: &*const T) -> bool {
300300 unsafe {
301- let a: uint = cast::reinterpret_cast(&( *self) );
302- let b: uint = cast::reinterpret_cast(&( *other) );
301+ let a: uint = cast::transmute( *self);
302+ let b: uint = cast::transmute( *other);
303303 return a > b;
304304 }
305305 }
@@ -350,7 +350,7 @@ pub mod ptr_tests {
350350 struct Pair {mut fst: int, mut snd: int};
351351 let mut p = Pair {fst: 10, snd: 20};
352352 let pptr: *mut Pair = &mut p;
353- let iptr: *mut int = cast::reinterpret_cast(& pptr);
353+ let iptr: *mut int = cast::transmute( pptr);
354354 assert!((*iptr == 10));;
355355 *iptr = 30;
356356 assert!((*iptr == 30));
0 commit comments