Skip to content

Commit 0d37ee7

Browse files
committed
---
yaml --- r: 32146 b: refs/heads/dist-snap c: 8d00603 h: refs/heads/master v: v3
1 parent 5997c95 commit 0d37ee7

File tree

3 files changed

+17
-29
lines changed

3 files changed

+17
-29
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 6cf2f89452675d231956324333180810273625b0
10+
refs/heads/dist-snap: 8d00603d782ee637fe9130b542fdee0c626b3810
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/src/libcore/future.rs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,25 +64,21 @@ fn from_value<A>(+val: A) -> Future<A> {
6464
})
6565
}
6666

67-
macro_rules! move_it (
68-
($x:expr) => { unsafe { let y <- *ptr::addr_of($x); y } }
69-
)
70-
7167
fn from_port<A:send>(+port: future_pipe::client::waiting<A>) -> Future<A> {
72-
#[doc = "
73-
Create a future from a port
74-
75-
The first time that the value is requested the task will block
76-
waiting for the result to be received on the port.
77-
"];
68+
/*!
69+
* Create a future from a port
70+
*
71+
* The first time that the value is requested the task will block
72+
* waiting for the result to be received on the port.
73+
*/
7874

7975
let port = ~mut some(port);
8076
do from_fn |move port| {
8177
let mut port_ = none;
8278
port_ <-> *port;
8379
let port = option::unwrap(port_);
8480
match recv(port) {
85-
future_pipe::completed(data) => move_it!(data)
81+
future_pipe::completed(move data) => data
8682
}
8783
}
8884
}

branches/dist-snap/src/libcore/pipes.rs

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ unsafe fn get_buffer<T: send>(p: *packet_header) -> ~buffer<T> {
325325
transmute((*p).buf_header())
326326
}
327327

328+
// This could probably be done with SharedMutableState to avoid move_it!().
328329
struct buffer_resource<T: send> {
329330
let buffer: ~buffer<T>;
330331
new(+b: ~buffer<T>) {
@@ -962,8 +963,8 @@ impl<T: send> chan<T>: channel<T> {
962963
let mut endp = none;
963964
endp <-> self.endp;
964965
match move streamp::client::try_data(unwrap(endp), x) {
965-
some(next) => {
966-
self.endp = some(move_it!(next));
966+
some(move next) => {
967+
self.endp = some(next);
967968
true
968969
}
969970
none => false
@@ -984,9 +985,9 @@ impl<T: send> port<T>: recv<T> {
984985
let mut endp = none;
985986
endp <-> self.endp;
986987
match move pipes::try_recv(unwrap(endp)) {
987-
some(streamp::data(x, endp)) => {
988-
self.endp = some(move_it!(endp));
989-
some(move_it!(x))
988+
some(streamp::data(move x, move endp)) => {
989+
self.endp = some(endp);
990+
some(x)
990991
}
991992
none => none
992993
}
@@ -1029,12 +1030,8 @@ struct PortSet<T: send> : recv<T> {
10291030
while result == none && ports.len() > 0 {
10301031
let i = wait_many(ports);
10311032
match move ports[i].try_recv() {
1032-
// FIXME (#2329): use this version once move from enum works.
1033-
//some(copy m) => {
1034-
// result = some(move m);
1035-
//}
1036-
some(m) => {
1037-
result = some(move_it!(m));
1033+
some(move m) => {
1034+
result = some(m);
10381035
}
10391036
none => {
10401037
// Remove this port.
@@ -1047,12 +1044,7 @@ struct PortSet<T: send> : recv<T> {
10471044
}
10481045

10491046
fn recv() -> T {
1050-
match move self.try_recv() {
1051-
// FIXME (#2329): use this version once move from enum works.
1052-
//some(copy x) => move x,
1053-
some(x) => move_it!(x),
1054-
none => fail ~"port_set: endpoints closed"
1055-
}
1047+
option::unwrap_expect(self.try_recv(), "port_set: endpoints closed")
10561048
}
10571049

10581050
pure fn peek() -> bool {

0 commit comments

Comments
 (0)