diff options
| author | Brian Anderson <banderson@mozilla.com> | 2012-09-29 16:33:34 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-09-29 16:33:53 -0700 |
| commit | affa3880debc91adde71e78345c30ce2044f8cef (patch) | |
| tree | 037f4564194c7f5f1034cb4a4b689beb6d16cf28 /src/libcore/task | |
| parent | 6bb0399df2123a2a87262b0f36ba0e56f1de787b (diff) | |
| download | rust-affa3880debc91adde71e78345c30ce2044f8cef.tar.gz rust-affa3880debc91adde71e78345c30ce2044f8cef.zip | |
core: Fix unsafe code in spawn_raw
Diffstat (limited to 'src/libcore/task')
| -rw-r--r-- | src/libcore/task/spawn.rs | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/libcore/task/spawn.rs b/src/libcore/task/spawn.rs index d410a4b192d..2095961e14e 100644 --- a/src/libcore/task/spawn.rs +++ b/src/libcore/task/spawn.rs @@ -511,15 +511,8 @@ 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); - /* - 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); + + let closure = cast::transmute(&child_wrapper); // Getting killed between these two calls would free the child's // closure. (Reordering them wouldn't help - then getting killed |
