about summary refs log tree commit diff
path: root/src/libcore/task
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-09-28 21:51:14 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-09-28 22:19:01 -0700
commit3639d38d5c982193eab8304f2adfe0fcd2dd84bd (patch)
tree84d883ad752071f14a4300e5f59a9a4944651e0b /src/libcore/task
parentf1014c43fd4e22fa1a8190e642e05dc6891d6eaa (diff)
downloadrust-3639d38d5c982193eab8304f2adfe0fcd2dd84bd.tar.gz
rust-3639d38d5c982193eab8304f2adfe0fcd2dd84bd.zip
Add a demoded version of ptr::addr_of
Currently, the new version is ptr::p2::addr_of and the old one is
ptr::addr_of. This is kind of cheesy, but I need a snapshot before I
can ditch the old version, since the pipe compiler generates calls to
addr_of.

core is converted over to use the new version, std is not.
Diffstat (limited to 'src/libcore/task')
-rw-r--r--src/libcore/task/local_data_priv.rs2
-rw-r--r--src/libcore/task/spawn.rs11
2 files changed, 10 insertions, 3 deletions
diff --git a/src/libcore/task/local_data_priv.rs b/src/libcore/task/local_data_priv.rs
index 31369c47c64..0d3007286c5 100644
--- a/src/libcore/task/local_data_priv.rs
+++ b/src/libcore/task/local_data_priv.rs
@@ -68,7 +68,7 @@ unsafe fn local_data_lookup<T: Owned>(
 
     let key_value = key_to_key_value(key);
     let map_pos = (*map).position(|entry|
-        match entry {
+        match *entry {
             Some((k,_,_)) => k == key_value,
             None => false
         }
diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs
index 7ae4c7b0950..d410a4b192d 100644
--- a/src/libcore/task/spawn.rs
+++ b/src/libcore/task/spawn.rs
@@ -66,7 +66,7 @@ use rt::rust_task;
 use rt::rust_closure;
 
 macro_rules! move_it (
-    { $x:expr } => { unsafe { let y <- *ptr::addr_of($x); move y } }
+    { $x:expr } => { unsafe { let y <- *ptr::p2::addr_of(&($x)); move y } }
 )
 
 type TaskSet = send_map::linear::LinearMap<*rust_task,()>;
@@ -511,7 +511,14 @@ fn spawn_raw(+opts: TaskOpts, +f: fn~()) {
 
             let child_wrapper = make_child_wrapper(new_task, move child_tg,
                   move ancestors, is_main, move notify_chan, move f);
-            let fptr = ptr::addr_of(child_wrapper);
+            /*
+            Truly awful, but otherwise the borrow checker complains about
+            the move in the last line of this block, for reasons I can't
+            understand. -- tjc
+            */
+            let tmp: u64 = cast::reinterpret_cast(&(&child_wrapper));
+            let whatever: &~fn() = cast::reinterpret_cast(&tmp);
+            let fptr = ptr::p2::addr_of(whatever);
             let closure: *rust_closure = cast::reinterpret_cast(&fptr);
 
             // Getting killed between these two calls would free the child's