File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 2929#![ feature( str_escape) ]
3030#![ feature( try_trait) ]
3131#![ feature( unicode_internals) ]
32+ #![ feature( catch_expr) ]
3233
3334#![ recursion_limit="256" ]
3435
Original file line number Diff line number Diff line change @@ -250,6 +250,8 @@ pub struct Parser<'a> {
250250 desugar_doc_comments : bool ,
251251 /// Whether we should configure out of line modules as we parse.
252252 pub cfg_mods : bool ,
253+ /// Whether we should prevent recovery from parsing areas (during backtracking).
254+ prevent_recovery : bool ,
253255}
254256
255257
@@ -569,6 +571,7 @@ impl<'a> Parser<'a> {
569571 } ,
570572 desugar_doc_comments,
571573 cfg_mods : true ,
574+ prevent_recovery : false ,
572575 } ;
573576
574577 let tok = parser. next_tok ( ) ;
@@ -1111,6 +1114,9 @@ impl<'a> Parser<'a> {
11111114 first = false ;
11121115 } else {
11131116 if let Err ( mut e) = self . expect ( t) {
1117+ if self . prevent_recovery {
1118+ return Err ( e) ;
1119+ }
11141120 // Attempt to keep parsing if it was a similar separator
11151121 if let Some ( ref tokens) = t. similar_tokens ( ) {
11161122 if tokens. contains ( & self . token ) {
@@ -2063,6 +2069,7 @@ impl<'a> Parser<'a> {
20632069 // We have to save a snapshot, because it could end up being an expression
20642070 // instead.
20652071 parser_snapshot_before_generics = Some ( self . clone ( ) ) ;
2072+ self . prevent_recovery = true ;
20662073 true
20672074 } {
20682075 // Generic arguments are found - `<`, `(`, `::<` or `::(`.
You can’t perform that action at this time.
0 commit comments