File tree Expand file tree Collapse file tree 1 file changed +4
-13
lines changed
compiler/rustc_parse/src/parser Expand file tree Collapse file tree 1 file changed +4
-13
lines changed Original file line number Diff line number Diff line change @@ -785,19 +785,10 @@ impl<'a> Parser<'a> {
785
785
}
786
786
} ;
787
787
788
- self . parse_and_disallow_postfix_after_cast ( cast_expr)
789
- }
790
-
791
- /// Parses a postfix operators such as `.`, `?`, or index (`[]`) after a cast,
792
- /// then emits an error and returns the newly parsed tree.
793
- /// The resulting parse tree for `&x as T[0]` has a precedence of `((&x) as T)[0]`.
794
- fn parse_and_disallow_postfix_after_cast (
795
- & mut self ,
796
- cast_expr : P < Expr > ,
797
- ) -> PResult < ' a , P < Expr > > {
798
- if let ExprKind :: Type ( _, _) = cast_expr. kind {
799
- panic ! ( "ExprKind::Type must not be parsed" ) ;
800
- }
788
+ // Try to parse a postfix operator such as `.`, `?`, or index (`[]`)
789
+ // after a cast. If one is present, emit an error then return a valid
790
+ // parse tree; For something like `&x as T[0]` will be as if it was
791
+ // written `((&x) as T)[0]`.
801
792
802
793
let span = cast_expr. span ;
803
794
You can’t perform that action at this time.
0 commit comments