@@ -134,10 +134,6 @@ struct MatcherPos<'tt> {
134
134
/// The number of sequences this mp is within.
135
135
seq_depth : usize ,
136
136
137
- /// The position in `matches` of the first metavar in this (sub)matcher. Zero if there are
138
- /// no metavars.
139
- match_lo : usize ,
140
-
141
137
/// The position in `matches` of the next metavar to be matched against the source token
142
138
/// stream. Should not be used if there are no metavars.
143
139
match_cur : usize ,
@@ -152,7 +148,7 @@ struct MatcherPos<'tt> {
152
148
153
149
// This type is used a lot. Make sure it doesn't unintentionally get bigger.
154
150
#[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
155
- rustc_data_structures:: static_assert_size!( MatcherPos <' _>, 104 ) ;
151
+ rustc_data_structures:: static_assert_size!( MatcherPos <' _>, 96 ) ;
156
152
157
153
impl < ' tt > MatcherPos < ' tt > {
158
154
fn top_level ( matcher : & ' tt [ TokenTree ] , empty_matches : Lrc < NamedMatchVec > ) -> Self {
@@ -161,7 +157,6 @@ impl<'tt> MatcherPos<'tt> {
161
157
idx : 0 ,
162
158
matches : empty_matches,
163
159
seq_depth : 0 ,
164
- match_lo : 0 ,
165
160
match_cur : 0 ,
166
161
stack : smallvec ! [ ] ,
167
162
sequence : None ,
@@ -178,14 +173,13 @@ impl<'tt> MatcherPos<'tt> {
178
173
idx : 0 ,
179
174
matches : parent. matches . clone ( ) ,
180
175
seq_depth : parent. seq_depth ,
181
- match_lo : parent. match_cur ,
182
176
match_cur : parent. match_cur ,
183
177
sequence : Some ( MatcherPosSequence { parent, seq } ) ,
184
178
stack : smallvec ! [ ] ,
185
179
} ;
186
180
// Start with an empty vec for each metavar within the sequence. Note that `mp.seq_depth`
187
181
// must have the parent's depth at this point for these `push_match` calls to work.
188
- for idx in mp. match_lo ..mp. match_lo + seq. num_captures {
182
+ for idx in mp. match_cur ..mp. match_cur + seq. num_captures {
189
183
mp. push_match ( idx, MatchedSeq ( empty_matches. clone ( ) ) ) ;
190
184
}
191
185
mp. seq_depth += 1 ;
@@ -554,7 +548,7 @@ impl<'tt> TtParser<'tt> {
554
548
// is finished.
555
549
let mut new_mp = sequence. parent . clone ( ) ;
556
550
new_mp. matches = mp. matches . clone ( ) ;
557
- new_mp. match_cur = mp. match_lo + sequence . seq . num_captures ;
551
+ new_mp. match_cur = mp. match_cur ;
558
552
new_mp. idx += 1 ;
559
553
self . cur_mps . push ( new_mp) ;
560
554
}
@@ -575,7 +569,7 @@ impl<'tt> TtParser<'tt> {
575
569
// We don't need a separator. Move the "dot" back to the beginning of the
576
570
// matcher and try to match again UNLESS we are only allowed to have _one_
577
571
// repetition.
578
- mp. match_cur = mp . match_lo ;
572
+ mp. match_cur -= sequence . seq . num_captures ;
579
573
mp. idx = 0 ;
580
574
self . cur_mps . push ( mp) ;
581
575
}
0 commit comments