about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2012-08-29 16:00:36 -0700
committerBrian Anderson <banderson@mozilla.com>2012-09-01 18:18:29 -0700
commitd777e5133360876baa4213f81a33934f04768a0f (patch)
tree13d3daefe774fc627d454cda2a043b0f95b57072 /src/libstd
parent6bfc80f8fb5b764d0e288a41960876fbbe662af2 (diff)
Demode reinterpret_cast
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/arena.rs18
-rw-r--r--src/libstd/dbg.rs4
-rw-r--r--src/libstd/par.rs2
-rw-r--r--src/libstd/rope.rs2
-rw-r--r--src/libstd/sync.rs4
5 files changed, 15 insertions, 15 deletions
diff --git a/src/libstd/arena.rs b/src/libstd/arena.rs
index 7609fa70454..52945c6765f 100644
--- a/src/libstd/arena.rs
+++ b/src/libstd/arena.rs
@@ -95,7 +95,7 @@ unsafe fn destroy_chunk(chunk: Chunk) {
     let fill = chunk.fill;
 
     while idx < fill {
-        let tydesc_data: *uint = reinterpret_cast(ptr::offset(buf, idx));
+        let tydesc_data: *uint = reinterpret_cast(&ptr::offset(buf, idx));
         let (tydesc, is_done) = un_bitpack_tydesc_ptr(*tydesc_data);
         let size = (*tydesc).size, align = (*tydesc).align;
 
@@ -121,12 +121,12 @@ unsafe fn destroy_chunk(chunk: Chunk) {
 // during an initializer.
 #[inline(always)]
 unsafe fn bitpack_tydesc_ptr(p: *TypeDesc, is_done: bool) -> uint {
-    let p_bits: uint = reinterpret_cast(p);
+    let p_bits: uint = reinterpret_cast(&p);
     p_bits | (is_done as uint)
 }
 #[inline(always)]
 unsafe fn un_bitpack_tydesc_ptr(p: uint) -> (*TypeDesc, bool) {
-    (reinterpret_cast(p & !1), p & 1 == 1)
+    (reinterpret_cast(&(p & !1)), p & 1 == 1)
 }
 
 // The duplication between the POD and non-POD functions is annoying.
@@ -167,9 +167,9 @@ impl &Arena {
         unsafe {
             let tydesc = sys::get_type_desc::<T>();
             let ptr = self.alloc_pod_inner((*tydesc).size, (*tydesc).align);
-            let ptr: *mut T = reinterpret_cast(ptr);
+            let ptr: *mut T = reinterpret_cast(&ptr);
             rusti::move_val_init(*ptr, op());
-            return reinterpret_cast(ptr);
+            return reinterpret_cast(&ptr);
         }
     }
 
@@ -213,18 +213,18 @@ impl &Arena {
             let tydesc = sys::get_type_desc::<T>();
             let (ty_ptr, ptr) =
                 self.alloc_nonpod_inner((*tydesc).size, (*tydesc).align);
-            let ty_ptr: *mut uint = reinterpret_cast(ty_ptr);
-            let ptr: *mut T = reinterpret_cast(ptr);
+            let ty_ptr: *mut uint = reinterpret_cast(&ty_ptr);
+            let ptr: *mut T = reinterpret_cast(&ptr);
             // Write in our tydesc along with a bit indicating that it
             // has *not* been initialized yet.
-            *ty_ptr = reinterpret_cast(tydesc);
+            *ty_ptr = reinterpret_cast(&tydesc);
             // Actually initialize it
             rusti::move_val_init(*ptr, op());
             // Now that we are done, update the tydesc to indicate that
             // the object is there.
             *ty_ptr = bitpack_tydesc_ptr(tydesc, true);
 
-            return reinterpret_cast(ptr);
+            return reinterpret_cast(&ptr);
         }
     }
 
diff --git a/src/libstd/dbg.rs b/src/libstd/dbg.rs
index 386cfee1a6a..bc016823b51 100644
--- a/src/libstd/dbg.rs
+++ b/src/libstd/dbg.rs
@@ -46,8 +46,8 @@ fn debug_fn<T>(+x: T) {
 
 unsafe fn ptr_cast<T, U>(x: @T) -> @U {
     reinterpret_cast(
-        rustrt::debug_ptrcast(sys::get_type_desc::<T>(),
-                              reinterpret_cast(x)))
+        &rustrt::debug_ptrcast(sys::get_type_desc::<T>(),
+                              reinterpret_cast(&x)))
 }
 
 /// Triggers a debugger breakpoint
diff --git a/src/libstd/par.rs b/src/libstd/par.rs
index d0e67c0009b..52366e33a27 100644
--- a/src/libstd/par.rs
+++ b/src/libstd/par.rs
@@ -48,7 +48,7 @@ fn map_slices<A: copy send, B: copy send>(
                                      len * sys::size_of::<A>());
                         log(info, fmt!("pre-slice: %?", (base, slice)));
                         let slice : &[A] =
-                            unsafe::reinterpret_cast(slice);
+                            unsafe::reinterpret_cast(&slice);
                         log(info, fmt!("slice: %?",
                                        (base, vec::len(slice), end - base)));
                         assert(vec::len(slice) == end - base);
diff --git a/src/libstd/rope.rs b/src/libstd/rope.rs
index 23f33a79c53..d6ba90af84c 100644
--- a/src/libstd/rope.rs
+++ b/src/libstd/rope.rs
@@ -807,7 +807,7 @@ mod node {
               option::Some(x) => {
                 //FIXME (#2744): Replace with memcpy or something similar
                 let mut local_buf: ~[u8] =
-                    unsafe::reinterpret_cast(*x.content);
+                    unsafe::reinterpret_cast(&*x.content);
                 let mut i = x.byte_offset;
                 while i < x.byte_len {
                     buf[offset] = local_buf[i];
diff --git a/src/libstd/sync.rs b/src/libstd/sync.rs
index acd25bd7c7c..b64376892e7 100644
--- a/src/libstd/sync.rs
+++ b/src/libstd/sync.rs
@@ -751,7 +751,7 @@ mod tests {
         let ptr = ptr::addr_of(*sharedstate);
         do task::spawn {
             let sharedstate: &mut int =
-                unsafe { unsafe::reinterpret_cast(ptr) };
+                unsafe { unsafe::reinterpret_cast(&ptr) };
             access_shared(sharedstate, m2, 10);
             c.send(());
 
@@ -1018,7 +1018,7 @@ mod tests {
         let ptr = ptr::addr_of(*sharedstate);
         do task::spawn {
             let sharedstate: &mut int =
-                unsafe { unsafe::reinterpret_cast(ptr) };
+                unsafe { unsafe::reinterpret_cast(&ptr) };
             access_shared(sharedstate, x2, mode1, 10);
             c.send(());
         }