diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2013-02-26 11:32:00 -0800 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2013-02-27 09:40:15 -0800 |
| commit | 8d7e6ef7725f8a11de940892a74398fc1911dfc7 (patch) | |
| tree | 44e7cd64fac348be5c823db76cdd9a0738c3074d /src/libstd/future.rs | |
| parent | 061a2237230d3abcdb30ecb8987e5de17e67a58e (diff) | |
| download | rust-8d7e6ef7725f8a11de940892a74398fc1911dfc7.tar.gz rust-8d7e6ef7725f8a11de940892a74398fc1911dfc7.zip | |
libsyntax: Forbid `~mut` and `~const`. rs=demuting
Diffstat (limited to 'src/libstd/future.rs')
| -rw-r--r-- | src/libstd/future.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/libstd/future.rs b/src/libstd/future.rs index b6b001727a4..7f48466ed0a 100644 --- a/src/libstd/future.rs +++ b/src/libstd/future.rs @@ -23,6 +23,7 @@ use core::cast::copy_lifetime; use core::cast; +use core::cell::Cell; use core::either::Either; use core::option; use core::comm::{oneshot, ChanOne, PortOne, send_one, recv_one}; @@ -103,11 +104,9 @@ pub fn from_port<A:Owned>(port: PortOne<A>) -> * waiting for the result to be received on the port. */ - let port = ~mut Some(port); + let port = Cell(port); do from_fn || { - let mut port_ = None; - port_ <-> *port; - let port = option::unwrap(port_); + let port = port.take(); match recv(port) { oneshot::send(data) => data } @@ -136,9 +135,9 @@ pub fn spawn<A:Owned>(blk: fn~() -> A) -> Future<A> { let (chan, port) = oneshot::init(); - let chan = ~mut Some(chan); + let chan = Cell(chan); do task::spawn || { - let chan = option::swap_unwrap(&mut *chan); + let chan = chan.take(); send_one(chan, blk()); } |
