Skip to content

Commit 4fc0532

Browse files
committed
Type ascription outputs a Type, not Cast
Previously this just errored out on all usages of type ascription, which isn't helpful.
1 parent 5ce9b80 commit 4fc0532

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/librustc_parse/parser/expr.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,9 @@ impl<'a> Parser<'a> {
645645

646646
// Check if an illegal postfix operator has been added after the cast.
647647
// If the resulting expression is not a cast, or has a different memory location, it is an illegal postfix operator.
648-
if !matches!(with_postfix.kind, ExprKind::Cast(_, _)) || after_hash != before_hash {
648+
if !matches!(with_postfix.kind, ExprKind::Cast(_, _) | ExprKind::Type(_, _))
649+
|| after_hash != before_hash
650+
{
649651
let expr_str = self.span_to_snippet(span);
650652

651653
let msg = format!(

0 commit comments

Comments
 (0)