Skip to content

Commit ea16e58

Browse files
committed
Remove parser support for recv as an initializer in preparation for changing the recv syntax.
1 parent 55b40e6 commit ea16e58

13 files changed

+32
-29
lines changed

src/comp/front/parser.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,11 +1442,13 @@ fn parse_initializer(&parser p) -> option::t[ast::initializer] {
14421442
ret some(rec(op = ast::init_assign,
14431443
expr = parse_expr(p)));
14441444
}
1445-
case (token::LARROW) {
1446-
p.bump();
1447-
ret some(rec(op = ast::init_recv,
1448-
expr = parse_expr(p)));
1449-
}
1445+
// Now that the the channel is the first argument to receive,
1446+
// combining it with an initializer doesn't really make sense.
1447+
// case (token::RECV) {
1448+
// p.bump();
1449+
// ret some(rec(op = ast::init_recv,
1450+
// expr = parse_expr(p)));
1451+
// }
14501452
case (_) {
14511453
ret none[ast::initializer];
14521454
}

src/test/run-fail/trivial-message2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn main() {
99
let port[int] po = port();
1010
let chan[int] ch = chan(po);
1111

12-
auto r <- po;
12+
auto r; r <- po;
1313

1414
ch <| 42;
1515

src/test/run-pass/decl-with-recv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ fn main() {
55
let chan[int] ch = chan(po);
66

77
ch <| 10;
8-
let int i <- po;
8+
let int i; i <- po;
99
assert (i == 10);
1010

1111
ch <| 11;
12-
auto j <- po;
12+
auto j; j <- po;
1313
assert (j == 11);
1414
}

src/test/run-pass/destructor-ordering.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ type order_info = rec(int order, str msg);
2424
io fn check_order(port[order_info] expected_p) {
2525
chan(expected_p) <| rec(order=-1, msg="");
2626
let mutable int actual = 0;
27-
auto expected <- expected_p; // FIXME #121: Workaround for while(true) bug.
27+
// FIXME #121: Workaround for while(true) bug.
28+
auto expected; expected <- expected_p;
2829
auto done = -1; // FIXME: Workaround for typechecking bug.
2930
while(expected.order != done) {
3031
if (expected.order != actual) {

src/test/run-pass/many.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn sub(chan[int] parent, int id) {
99
} else {
1010
let port[int] p = port();
1111
auto child = spawn sub(chan(p), id-1);
12-
let int y <- p;
12+
let int y; y <- p;
1313
parent <| y + 1;
1414
}
1515
}

src/test/run-pass/rt-circular-buffer.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn test_shrink1() {
4444
auto mychan = chan(myport);
4545

4646
mychan <| 0i8;
47-
auto x <- myport;
47+
auto x; x <- myport;
4848
}
4949

5050
fn test_shrink2() {
@@ -58,7 +58,7 @@ fn test_shrink2() {
5858
}
5959

6060
for each (uint i in uint::range(0u, 100u)) {
61-
auto x <- myport;
61+
auto x; x <- myport;
6262
}
6363
}
6464

@@ -73,7 +73,7 @@ fn test_rotate() {
7373
val3=i as u32);
7474
mychan <| val;
7575

76-
auto x <- myport;
76+
auto x; x <- myport;
7777
assert (x.val1 == i as u32);
7878
assert (x.val2 == i as u32);
7979
assert (x.val3 == i as u32);
@@ -95,7 +95,7 @@ fn test_rotate_grow() {
9595
}
9696

9797
for each (uint i in uint::range(0u, 10u)) {
98-
auto x <- myport;
98+
auto x; x <- myport;
9999
assert (x.val1 == i as u32);
100100
assert (x.val2 == i as u32);
101101
assert (x.val3 == i as u32);

src/test/run-pass/task-comm-0.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn test05() {
1515
let port[int] po = port();
1616
let chan[int] ch = chan(po);
1717
spawn test05_start(chan(po));
18-
let int value <- po;
18+
let int value; value <- po;
1919
value <- po;
2020
value <- po;
2121
assert (value == 30);

src/test/run-pass/task-comm-10.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
fn start(chan[chan[str]] c) {
55
let port[str] p = port();
66
c <| chan(p);
7-
auto a <- p;
8-
// auto b <- p; // Never read the second string.
7+
auto a; a <- p;
8+
// auto b; b <- p; // Never read the second string.
99
}
1010

1111
fn main() {
1212
let port[chan[str]] p = port();
1313
auto child = spawn "start" start(chan(p));
14-
auto c <- p;
14+
auto c; c <- p;
1515
c <| "A";
1616
c <| "B";
1717
yield;
18-
}
18+
}

src/test/run-pass/task-comm-11.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ fn start(chan[chan[str]] c) {
99
fn main() {
1010
let port[chan[str]] p = port();
1111
auto child = spawn "child" start(chan(p));
12-
auto c <- p;
13-
}
12+
auto c; c <- p;
13+
}

src/test/run-pass/task-comm-15.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ fn main() {
1717
// the child's point of view the receiver may die. We should
1818
// drop messages on the floor in this case, and not crash!
1919
auto child = spawn thread "child" start(chan(p), 10);
20-
auto c <- p;
21-
}
20+
auto c; c <- p;
21+
}

src/test/run-pass/task-comm-3.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn test00(bool is_multithreaded) {
4747
for (task t in tasks) {
4848
i = 0;
4949
while (i < number_of_messages) {
50-
let int value <- po;
50+
let int value; value <- po;
5151
sum += value;
5252
i = i + 1;
5353
}

src/test/run-pass/task-comm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn test00(bool is_multithreaded) {
4848
for (task t in tasks) {
4949
i = 0;
5050
while (i < number_of_messages) {
51-
let int value <- po;
51+
let int value; value <- po;
5252
sum += value;
5353
i = i + 1;
5454
}
@@ -66,7 +66,7 @@ fn test00(bool is_multithreaded) {
6666
fn test01() {
6767
let port[int] p = port();
6868
log "Reading from a port that is never written to.";
69-
let int value <- p;
69+
let int value; value <- p;
7070
log value;
7171
}
7272

@@ -76,7 +76,7 @@ fn test02() {
7676
log "Writing to a local task channel.";
7777
c <| 42;
7878
log "Reading from a local task port.";
79-
let int value <- p;
79+
let int value; value <- p;
8080
log value;
8181
}
8282

@@ -126,7 +126,7 @@ fn test05() {
126126
let port[int] po = port();
127127
let chan[int] ch = chan(po);
128128
spawn thread test05_start(ch);
129-
let int value <- po;
129+
let int value; value <- po;
130130
value <- po;
131131
value <- po;
132132
log value;

src/test/run-pass/trivial-message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ fn main() {
99

1010
ch <| 42;
1111

12-
auto r <- po;
12+
auto r; r <- po;
1313

1414
log_err r;
1515
}

0 commit comments

Comments
 (0)