Skip to content

Commit 4e5865f

Browse files
committed
Fix #1458 (allow paren'd exprs to be the operator in a do)
Closes #1458
1 parent 165ce14 commit 4e5865f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/libsyntax/parse/parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,7 @@ impl Parser {
15761576
@{node: expr_call(f, args, true),
15771577
.. *e}
15781578
}
1579-
expr_path(*) | expr_field(*) | expr_call(*) => {
1579+
expr_path(*) | expr_field(*) | expr_call(*) | expr_paren(*) => {
15801580
let block = self.parse_lambda_block_expr();
15811581
let last_arg = self.mk_expr(block.span.lo, block.span.hi,
15821582
ctor(block));

src/test/run-pass/issue-1458.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
fn plus_one(f: fn() -> int) -> int {
2+
return f() + 1;
3+
}
4+
5+
fn ret_plus_one() -> fn(fn() -> int) -> int {
6+
return plus_one;
7+
}
8+
9+
fn main() {
10+
let z = do (ret_plus_one()) || { 2 };
11+
assert z == 3;
12+
}

0 commit comments

Comments
 (0)