about summary refs log tree commit diff
path: root/src/libstd/future.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2013-04-26 18:52:15 -0700
committerPatrick Walton <pcwalton@mimiga.net>2013-04-29 14:30:57 -0700
commit37abf4bad0eda08cf4ef756310443329fa28f6cf (patch)
treee9bdcfadf21cd0d1a6001a09af5a336cb9db7d50 /src/libstd/future.rs
parent670ab8ac367cd8cfe8b86a1338667e7825d8d68d (diff)
downloadrust-37abf4bad0eda08cf4ef756310443329fa28f6cf.tar.gz
rust-37abf4bad0eda08cf4ef756310443329fa28f6cf.zip
librustc: Forbid type implementations on typedefs.
Diffstat (limited to 'src/libstd/future.rs')
-rw-r--r--src/libstd/future.rs13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/libstd/future.rs b/src/libstd/future.rs
index 264f3072cb1..c6c593d7b4a 100644
--- a/src/libstd/future.rs
+++ b/src/libstd/future.rs
@@ -23,7 +23,7 @@
 
 use core::cast;
 use core::cell::Cell;
-use core::comm::{oneshot, PortOne, send_one};
+use core::comm::{ChanOne, PortOne, oneshot, send_one};
 use core::pipes::recv;
 use core::task;
 
@@ -120,8 +120,7 @@ pub fn from_value<A>(val: A) -> Future<A> {
     Future {state: Forced(val)}
 }
 
-pub fn from_port<A:Owned>(port: PortOne<A>) ->
-        Future<A> {
+pub fn from_port<A:Owned>(port: PortOne<A>) -> Future<A> {
     /*!
      * Create a future from a port
      *
@@ -131,7 +130,7 @@ pub fn from_port<A:Owned>(port: PortOne<A>) ->
 
     let port = Cell(port);
     do from_fn || {
-        let port = port.take();
+        let port = port.take().unwrap();
         match recv(port) {
             oneshot::send(data) => data
         }
@@ -158,10 +157,10 @@ pub fn spawn<A:Owned>(blk: ~fn() -> A) -> Future<A> {
      * value of the future.
      */
 
-    let (chan, port) = oneshot::init();
+    let (port, chan) = oneshot();
 
     let chan = Cell(chan);
-    do task::spawn || {
+    do task::spawn {
         let chan = chan.take();
         send_one(chan, blk());
     }
@@ -186,7 +185,7 @@ mod test {
 
     #[test]
     fn test_from_port() {
-        let (ch, po) = oneshot::init();
+        let (ch, po) = oneshot();
         send_one(ch, ~"whale");
         let f = from_port(po);
         assert!(f.get() == ~"whale");