File tree 2 files changed +8
-0
lines changed
2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 29
29
#![ feature( str_escape) ]
30
30
#![ feature( try_trait) ]
31
31
#![ feature( unicode_internals) ]
32
+ #![ feature( catch_expr) ]
32
33
33
34
#![ recursion_limit="256" ]
34
35
Original file line number Diff line number Diff line change @@ -250,6 +250,8 @@ pub struct Parser<'a> {
250
250
desugar_doc_comments : bool ,
251
251
/// Whether we should configure out of line modules as we parse.
252
252
pub cfg_mods : bool ,
253
+ /// Whether we should prevent recovery from parsing areas (during backtracking).
254
+ prevent_recovery : bool ,
253
255
}
254
256
255
257
@@ -569,6 +571,7 @@ impl<'a> Parser<'a> {
569
571
} ,
570
572
desugar_doc_comments,
571
573
cfg_mods : true ,
574
+ prevent_recovery : false ,
572
575
} ;
573
576
574
577
let tok = parser. next_tok ( ) ;
@@ -1111,6 +1114,9 @@ impl<'a> Parser<'a> {
1111
1114
first = false ;
1112
1115
} else {
1113
1116
if let Err ( mut e) = self . expect ( t) {
1117
+ if self . prevent_recovery {
1118
+ return Err ( e) ;
1119
+ }
1114
1120
// Attempt to keep parsing if it was a similar separator
1115
1121
if let Some ( ref tokens) = t. similar_tokens ( ) {
1116
1122
if tokens. contains ( & self . token ) {
@@ -2063,6 +2069,7 @@ impl<'a> Parser<'a> {
2063
2069
// We have to save a snapshot, because it could end up being an expression
2064
2070
// instead.
2065
2071
parser_snapshot_before_generics = Some ( self . clone ( ) ) ;
2072
+ self . prevent_recovery = true ;
2066
2073
true
2067
2074
} {
2068
2075
// Generic arguments are found - `<`, `(`, `::<` or `::(`.
You can’t perform that action at this time.
0 commit comments