@@ -2641,36 +2641,6 @@ impl<'a> Parser<'a> {
2641
2641
// yet.
2642
2642
maybe_whole ! ( deref self , NtTT ) ;
2643
2643
2644
- // this is the fall-through for the 'match' below.
2645
- // invariants: the current token is not a left-delimiter,
2646
- // not an EOF, and not the desired right-delimiter (if
2647
- // it were, parse_seq_to_before_end would have prevented
2648
- // reaching this point.
2649
- fn parse_non_delim_tt_tok < ' b > ( p : & mut Parser < ' b > ) -> PResult < ' b , TokenTree > {
2650
- maybe_whole ! ( deref p, NtTT ) ;
2651
- match p. token {
2652
- token:: CloseDelim ( _) => {
2653
- let token_str = p. this_token_to_string ( ) ;
2654
- let mut err = p. fatal (
2655
- & format ! ( "incorrect close delimiter: `{}`" , token_str) ) ;
2656
- // This is a conservative error: only report the last unclosed delimiter. The
2657
- // previous unclosed delimiters could actually be closed! The parser just hasn't
2658
- // gotten to them yet.
2659
- if let Some ( & sp) = p. open_braces . last ( ) {
2660
- err. span_note ( sp, "unclosed delimiter" ) ;
2661
- } ;
2662
- Err ( err)
2663
- } ,
2664
- /* we ought to allow different depths of unquotation */
2665
- token:: Dollar | token:: SubstNt ( ..) if p. quote_depth > 0 => {
2666
- p. parse_unquoted ( )
2667
- }
2668
- _ => {
2669
- Ok ( TokenTree :: Token ( p. span , p. bump_and_get ( ) ) )
2670
- }
2671
- }
2672
- }
2673
-
2674
2644
match self . token {
2675
2645
token:: Eof => {
2676
2646
let open_braces = self . open_braces . clone ( ) ;
@@ -2712,7 +2682,34 @@ impl<'a> Parser<'a> {
2712
2682
close_span : close_span,
2713
2683
} ) ) )
2714
2684
} ,
2715
- _ => parse_non_delim_tt_tok ( self ) ,
2685
+ _ => {
2686
+ // invariants: the current token is not a left-delimiter,
2687
+ // not an EOF, and not the desired right-delimiter (if
2688
+ // it were, parse_seq_to_before_end would have prevented
2689
+ // reaching this point.
2690
+ maybe_whole ! ( deref self , NtTT ) ;
2691
+ match self . token {
2692
+ token:: CloseDelim ( _) => {
2693
+ let token_str = self . this_token_to_string ( ) ;
2694
+ let mut err = self . fatal (
2695
+ & format ! ( "incorrect close delimiter: `{}`" , token_str) ) ;
2696
+ // This is a conservative error: only report the last unclosed delimiter.
2697
+ // The previous unclosed delimiters could actually be closed! The parser
2698
+ // just hasn't gotten to them yet.
2699
+ if let Some ( & sp) = self . open_braces . last ( ) {
2700
+ err. span_note ( sp, "unclosed delimiter" ) ;
2701
+ } ;
2702
+ Err ( err)
2703
+ } ,
2704
+ /* we ought to allow different depths of unquotation */
2705
+ token:: Dollar | token:: SubstNt ( ..) if self . quote_depth > 0 => {
2706
+ self . parse_unquoted ( )
2707
+ }
2708
+ _ => {
2709
+ Ok ( TokenTree :: Token ( self . span , self . bump_and_get ( ) ) )
2710
+ }
2711
+ }
2712
+ }
2716
2713
}
2717
2714
}
2718
2715
0 commit comments