about summary refs log tree commit diff
path: root/src/libstd/rt/task.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-12-05 17:36:30 -0800
committerPatrick Walton <pcwalton@mimiga.net>2013-12-10 15:13:13 -0800
commit61135080554d35cca151614c93693cb524fdffe0 (patch)
treef8ef546d0748fc1fcff45f62284effa6e179bfc3 /src/libstd/rt/task.rs
parent89e1db3d6ce37946afd7115dfcce510261537a85 (diff)
downloadrust-61135080554d35cca151614c93693cb524fdffe0.tar.gz
rust-61135080554d35cca151614c93693cb524fdffe0.zip
libstd: Remove two uses of `Cell`.
Diffstat (limited to 'src/libstd/rt/task.rs')
-rw-r--r--src/libstd/rt/task.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs
index 0cb60c58a6d..86cc895eb27 100644
--- a/src/libstd/rt/task.rs
+++ b/src/libstd/rt/task.rs
@@ -19,7 +19,6 @@ use prelude::*;
 
 use borrow;
 use cast::transmute;
-use cell::Cell;
 use cleanup;
 use libc::{c_void, uintptr_t, c_char, size_t};
 use local_data;
@@ -427,7 +426,6 @@ impl Coroutine {
     }
 
     fn build_start_wrapper(start: proc()) -> proc() {
-        let start_cell = Cell::new(start);
         let wrapper: proc() = proc() {
             // First code after swap to this new context. Run our
             // cleanup job.
@@ -446,6 +444,7 @@ impl Coroutine {
                 // need to unsafe_borrow.
                 let task: *mut Task = Local::unsafe_borrow();
 
+                let mut start_cell = Some(start);
                 (*task).run(|| {
                     // N.B. Removing `start` from the start wrapper
                     // closure by emptying a cell is critical for
@@ -457,7 +456,7 @@ impl Coroutine {
                     // be in task context. By moving `start` out of
                     // the closure, all the user code goes our of
                     // scope while the task is still running.
-                    let start = start_cell.take();
+                    let start = start_cell.take_unwrap();
                     start();
                 });
             }