@@ -83,7 +83,7 @@ use syntax::print::pprust;
8383use syntax:: sess:: ParseSess ;
8484use syntax:: symbol:: { kw, sym, Symbol } ;
8585use syntax:: token:: { self , DocComment , Nonterminal , Token } ;
86- use syntax:: tokenstream:: { DelimSpan , TokenStream } ;
86+ use syntax:: tokenstream:: TokenStream ;
8787
8888use errors:: { PResult , FatalError } ;
8989use smallvec:: { smallvec, SmallVec } ;
@@ -164,11 +164,6 @@ struct MatcherPos<'root, 'tt> {
164164 /// The position of the "dot" in this matcher
165165 idx : usize ,
166166
167- /// The first span of source that the beginning of this matcher corresponds to. In other
168- /// words, the token in the source whose span is `sp_open` is matched against the first token of
169- /// the matcher.
170- sp_open : Span ,
171-
172167 /// For each named metavar in the matcher, we keep track of token trees matched against the
173168 /// metavar by the black box parser. In particular, there may be more than one match per
174169 /// metavar if we are in a repetition (each repetition matches each of the variables).
@@ -307,17 +302,15 @@ fn create_matches(len: usize) -> Box<[Lrc<NamedMatchVec>]> {
307302}
308303
309304/// Generates the top-level matcher position in which the "dot" is before the first token of the
310- /// matcher `ms` and we are going to start matching at the span `open` in the source .
311- fn initial_matcher_pos < ' root , ' tt > ( ms : & ' tt [ TokenTree ] , open : Span ) -> MatcherPos < ' root , ' tt > {
305+ /// matcher `ms`.
306+ fn initial_matcher_pos < ' root , ' tt > ( ms : & ' tt [ TokenTree ] ) -> MatcherPos < ' root , ' tt > {
312307 let match_idx_hi = count_names ( ms) ;
313308 let matches = create_matches ( match_idx_hi) ;
314309 MatcherPos {
315310 // Start with the top level matcher given to us
316311 top_elts : TtSeq ( ms) , // "elts" is an abbr. for "elements"
317312 // The "dot" is before the first token of the matcher
318313 idx : 0 ,
319- // We start matching at the span `open` in the source code
320- sp_open : open,
321314
322315 // Initialize `matches` to a bunch of empty `Vec`s -- one for each metavar in `top_elts`.
323316 // `match_lo` for `top_elts` is 0 and `match_hi` is `matches.len()`. `match_cur` is 0 since
@@ -355,7 +348,7 @@ fn initial_matcher_pos<'root, 'tt>(ms: &'tt [TokenTree], open: Span) -> MatcherP
355348/// token tree it was derived from.
356349#[ derive( Debug , Clone ) ]
357350crate enum NamedMatch {
358- MatchedSeq ( Lrc < NamedMatchVec > , DelimSpan ) ,
351+ MatchedSeq ( Lrc < NamedMatchVec > ) ,
359352 MatchedNonterminal ( Lrc < Nonterminal > ) ,
360353}
361354
@@ -497,8 +490,7 @@ fn inner_parse_loop<'root, 'tt>(
497490 // Add matches from this repetition to the `matches` of `up`
498491 for idx in item. match_lo ..item. match_hi {
499492 let sub = item. matches [ idx] . clone ( ) ;
500- let span = DelimSpan :: from_pair ( item. sp_open , token. span ) ;
501- new_pos. push_match ( idx, MatchedSeq ( sub, span) ) ;
493+ new_pos. push_match ( idx, MatchedSeq ( sub) ) ;
502494 }
503495
504496 // Move the "dot" past the repetition in `up`
@@ -552,7 +544,7 @@ fn inner_parse_loop<'root, 'tt>(
552544 new_item. match_cur += seq. num_captures ;
553545 new_item. idx += 1 ;
554546 for idx in item. match_cur ..item. match_cur + seq. num_captures {
555- new_item. push_match ( idx, MatchedSeq ( Lrc :: new ( smallvec ! [ ] ) , sp ) ) ;
547+ new_item. push_match ( idx, MatchedSeq ( Lrc :: new ( smallvec ! [ ] ) ) ) ;
556548 }
557549 cur_items. push ( new_item) ;
558550 }
@@ -568,7 +560,6 @@ fn inner_parse_loop<'root, 'tt>(
568560 match_cur : item. match_cur ,
569561 match_hi : item. match_cur + seq. num_captures ,
570562 up : Some ( item) ,
571- sp_open : sp. open ,
572563 top_elts : Tt ( TokenTree :: Sequence ( sp, seq) ) ,
573564 } ) ) ) ;
574565 }
@@ -663,7 +654,7 @@ pub(super) fn parse(
663654 //
664655 // This MatcherPos instance is allocated on the stack. All others -- and
665656 // there are frequently *no* others! -- are allocated on the heap.
666- let mut initial = initial_matcher_pos ( ms, parser . token . span ) ;
657+ let mut initial = initial_matcher_pos ( ms) ;
667658 let mut cur_items = smallvec ! [ MatcherPosHandle :: Ref ( & mut initial) ] ;
668659 let mut next_items = Vec :: new ( ) ;
669660
0 commit comments