Skip to content

Commit 81f19ec

Browse files
authored
Rollup merge of #70556 - Centril:fix-70552, r=estebank
parse_and_disallow_postfix_after_cast: account for `ExprKind::Err`. Fixes #70552. r? @estebank cc @daboross
2 parents 8993358 + 96d7353 commit 81f19ec

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

src/librustc_parse/parser/expr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ impl<'a> Parser<'a> {
638638
ExprKind::MethodCall(_, _) => "a method call",
639639
ExprKind::Call(_, _) => "a function call",
640640
ExprKind::Await(_) => "`.await`",
641+
ExprKind::Err => return Ok(with_postfix),
641642
_ => unreachable!("parse_dot_or_call_expr_with_ shouldn't produce this"),
642643
}
643644
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
expr as fun()(:); //~ ERROR expected expression
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected expression, found `:`
2+
--> $DIR/issue-70552-ascription-in-parens-after-call.rs:2:19
3+
|
4+
LL | expr as fun()(:);
5+
| ^ expected expression
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)