@@ -160,7 +160,7 @@ struct MatcherPos<'tt> {
160
160
161
161
// This type is used a lot. Make sure it doesn't unintentionally get bigger.
162
162
#[ cfg( all( target_arch = "x86_64" , target_pointer_width = "64" ) ) ]
163
- rustc_data_structures:: static_assert_size!( MatcherPos <' _>, 136 ) ;
163
+ rustc_data_structures:: static_assert_size!( MatcherPos <' _>, 112 ) ;
164
164
165
165
impl < ' tt > MatcherPos < ' tt > {
166
166
/// `len` `Vec`s (initially shared and empty) that will store matches of metavars.
@@ -209,11 +209,7 @@ impl<'tt> MatcherPos<'tt> {
209
209
match_lo : up. match_cur ,
210
210
match_cur : up. match_cur ,
211
211
match_hi : up. match_cur + seq. num_captures ,
212
- repetition : Some ( MatcherPosRepetition {
213
- up,
214
- sep : seq. separator . clone ( ) ,
215
- seq_op : seq. kleene . op ,
216
- } ) ,
212
+ repetition : Some ( MatcherPosRepetition { up, seq } ) ,
217
213
stack : smallvec ! [ ] ,
218
214
}
219
215
}
@@ -227,15 +223,12 @@ impl<'tt> MatcherPos<'tt> {
227
223
228
224
#[ derive( Clone ) ]
229
225
struct MatcherPosRepetition < ' tt > {
230
- /// The KleeneOp of this sequence.
231
- seq_op : mbe:: KleeneOp ,
232
-
233
- /// The separator.
234
- sep : Option < Token > ,
235
-
236
226
/// The "parent" matcher position. That is, the matcher position just before we enter the
237
227
/// sequence.
238
228
up : Box < MatcherPos < ' tt > > ,
229
+
230
+ /// The sequence itself.
231
+ seq : & ' tt SequenceRepetition ,
239
232
}
240
233
241
234
enum EofItems < ' tt > {
@@ -559,14 +552,19 @@ impl<'tt> TtParser<'tt> {
559
552
self . cur_items . push ( new_pos) ;
560
553
}
561
554
562
- if idx == len && repetition. sep . is_some ( ) {
563
- if repetition. sep . as_ref ( ) . map_or ( false , |sep| token_name_eq ( token, sep) ) {
555
+ if idx == len && repetition. seq . separator . is_some ( ) {
556
+ if repetition
557
+ . seq
558
+ . separator
559
+ . as_ref ( )
560
+ . map_or ( false , |sep| token_name_eq ( token, sep) )
561
+ {
564
562
// The matcher has a separator, and it matches the current token. We can
565
563
// advance past the separator token.
566
564
item. idx += 1 ;
567
565
self . next_items . push ( item) ;
568
566
}
569
- } else if repetition. seq_op != mbe:: KleeneOp :: ZeroOrOne {
567
+ } else if repetition. seq . kleene . op != mbe:: KleeneOp :: ZeroOrOne {
570
568
// We don't need a separator. Move the "dot" back to the beginning of the
571
569
// matcher and try to match again UNLESS we are only allowed to have _one_
572
570
// repetition.
0 commit comments