From 4fc0532269f40c2870936faaebcdd14539613411 Mon Sep 17 00:00:00 2001 From: David Ross Date: Sat, 15 Feb 2020 16:18:20 -0800 Subject: [PATCH] Type ascription outputs a Type, not Cast Previously this just errored out on all usages of type ascription, which isn't helpful. --- src/librustc_parse/parser/expr.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/librustc_parse/parser/expr.rs b/src/librustc_parse/parser/expr.rs index 76e4a80878f1..645e680d15f4 100644 --- a/src/librustc_parse/parser/expr.rs +++ b/src/librustc_parse/parser/expr.rs @@ -645,7 +645,9 @@ impl<'a> Parser<'a> { // Check if an illegal postfix operator has been added after the cast. // If the resulting expression is not a cast, or has a different memory location, it is an illegal postfix operator. - if !matches!(with_postfix.kind, ExprKind::Cast(_, _)) || after_hash != before_hash { + if !matches!(with_postfix.kind, ExprKind::Cast(_, _) | ExprKind::Type(_, _)) + || after_hash != before_hash + { let expr_str = self.span_to_snippet(span); let msg = format!(