From 37abf4bad0eda08cf4ef756310443329fa28f6cf Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 26 Apr 2013 18:52:15 -0700 Subject: librustc: Forbid type implementations on typedefs. --- src/libstd/future.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'src/libstd/future.rs') 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(val: A) -> Future { Future {state: Forced(val)} } -pub fn from_port(port: PortOne) -> - Future { +pub fn from_port(port: PortOne) -> Future { /*! * Create a future from a port * @@ -131,7 +130,7 @@ pub fn from_port(port: PortOne) -> 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(blk: ~fn() -> A) -> Future { * 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"); -- cgit 1.4.1-3-g733a5