diff --git a/src/libcore/future.rs b/src/libcore/future.rs
index 10a13766140..7bc7789c9c3 100644
--- a/src/libcore/future.rs
+++ b/src/libcore/future.rs
@@ -64,17 +64,13 @@ fn from_value(+val: A) -> Future {
})
}
-macro_rules! move_it (
- ($x:expr) => { unsafe { let y <- *ptr::addr_of($x); y } }
-)
-
fn from_port(+port: future_pipe::client::waiting) -> Future {
- #[doc = "
- Create a future from a port
-
- The first time that the value is requested the task will block
- waiting for the result to be received on the port.
- "];
+ /*!
+ * Create a future from a port
+ *
+ * The first time that the value is requested the task will block
+ * waiting for the result to be received on the port.
+ */
let port = ~mut some(port);
do from_fn |move port| {
@@ -82,7 +78,7 @@ fn from_port(+port: future_pipe::client::waiting) -> Future {
port_ <-> *port;
let port = option::unwrap(port_);
match recv(port) {
- future_pipe::completed(data) => move_it!(data)
+ future_pipe::completed(move data) => data
}
}
}
diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs
index ad058cb9b40..41542a5a830 100644
--- a/src/libcore/pipes.rs
+++ b/src/libcore/pipes.rs
@@ -325,6 +325,7 @@ unsafe fn get_buffer(p: *packet_header) -> ~buffer {
transmute((*p).buf_header())
}
+// This could probably be done with SharedMutableState to avoid move_it!().
struct buffer_resource {
let buffer: ~buffer;
new(+b: ~buffer) {
@@ -962,8 +963,8 @@ impl chan: channel {
let mut endp = none;
endp <-> self.endp;
match move streamp::client::try_data(unwrap(endp), x) {
- some(next) => {
- self.endp = some(move_it!(next));
+ some(move next) => {
+ self.endp = some(next);
true
}
none => false
@@ -984,9 +985,9 @@ impl port: recv {
let mut endp = none;
endp <-> self.endp;
match move pipes::try_recv(unwrap(endp)) {
- some(streamp::data(x, endp)) => {
- self.endp = some(move_it!(endp));
- some(move_it!(x))
+ some(streamp::data(move x, move endp)) => {
+ self.endp = some(endp);
+ some(x)
}
none => none
}
@@ -1029,12 +1030,8 @@ struct PortSet : recv {
while result == none && ports.len() > 0 {
let i = wait_many(ports);
match move ports[i].try_recv() {
- // FIXME (#2329): use this version once move from enum works.
- //some(copy m) => {
- // result = some(move m);
- //}
- some(m) => {
- result = some(move_it!(m));
+ some(move m) => {
+ result = some(m);
}
none => {
// Remove this port.
@@ -1047,12 +1044,7 @@ struct PortSet : recv {
}
fn recv() -> T {
- match move self.try_recv() {
- // FIXME (#2329): use this version once move from enum works.
- //some(copy x) => move x,
- some(x) => move_it!(x),
- none => fail ~"port_set: endpoints closed"
- }
+ option::unwrap_expect(self.try_recv(), "port_set: endpoints closed")
}
pure fn peek() -> bool {