@@ -106,9 +106,9 @@ rustc_data_structures::static_assert_size!(NamedMatchVec, 48);
106
106
///
107
107
/// This means a matcher can be represented by `&[MatcherLoc]`, and traversal mostly involves
108
108
/// simply incrementing the current matcher position index by one.
109
- enum MatcherLoc < ' tt > {
109
+ enum MatcherLoc {
110
110
Token {
111
- token : & ' tt Token ,
111
+ token : Token ,
112
112
} ,
113
113
Delimited ,
114
114
Sequence {
@@ -123,7 +123,7 @@ enum MatcherLoc<'tt> {
123
123
idx_first : usize ,
124
124
} ,
125
125
SequenceSep {
126
- separator : & ' tt Token ,
126
+ separator : Token ,
127
127
} ,
128
128
SequenceKleeneOpAfterSep {
129
129
idx_first : usize ,
@@ -298,11 +298,11 @@ fn token_name_eq(t1: &Token, t2: &Token) -> bool {
298
298
299
299
// Note: the vectors could be created and dropped within `parse_tt`, but to avoid excess
300
300
// allocations we have a single vector fo each kind that is cleared and reused repeatedly.
301
- pub struct TtParser < ' tt > {
301
+ pub struct TtParser {
302
302
macro_name : Ident ,
303
303
304
304
/// The matcher of the current rule.
305
- locs : Vec < MatcherLoc < ' tt > > ,
305
+ locs : Vec < MatcherLoc > ,
306
306
307
307
/// The set of current mps to be processed. This should be empty by the end of a successful
308
308
/// execution of `parse_tt_inner`.
@@ -320,8 +320,8 @@ pub struct TtParser<'tt> {
320
320
empty_matches : Lrc < NamedMatchVec > ,
321
321
}
322
322
323
- impl < ' tt > TtParser < ' tt > {
324
- pub ( super ) fn new ( macro_name : Ident ) -> TtParser < ' tt > {
323
+ impl TtParser {
324
+ pub ( super ) fn new ( macro_name : Ident ) -> TtParser {
325
325
TtParser {
326
326
macro_name,
327
327
locs : vec ! [ ] ,
@@ -340,19 +340,19 @@ impl<'tt> TtParser<'tt> {
340
340
fn compute_locs (
341
341
& mut self ,
342
342
sess : & ParseSess ,
343
- matcher : & ' tt [ TokenTree ] ,
343
+ matcher : & [ TokenTree ] ,
344
344
) -> Result < usize , ( Span , String ) > {
345
- fn inner < ' tt > (
345
+ fn inner (
346
346
sess : & ParseSess ,
347
- tts : & ' tt [ TokenTree ] ,
348
- locs : & mut Vec < MatcherLoc < ' tt > > ,
347
+ tts : & [ TokenTree ] ,
348
+ locs : & mut Vec < MatcherLoc > ,
349
349
next_metavar : & mut usize ,
350
350
seq_depth : usize ,
351
351
) -> Result < ( ) , ( Span , String ) > {
352
352
for tt in tts {
353
353
match tt {
354
354
TokenTree :: Token ( token) => {
355
- locs. push ( MatcherLoc :: Token { token } ) ;
355
+ locs. push ( MatcherLoc :: Token { token : token . clone ( ) } ) ;
356
356
}
357
357
TokenTree :: Delimited ( _, delimited) => {
358
358
locs. push ( MatcherLoc :: Delimited ) ;
@@ -373,7 +373,7 @@ impl<'tt> TtParser<'tt> {
373
373
inner ( sess, & seq. tts , locs, next_metavar, seq_depth + 1 ) ?;
374
374
375
375
if let Some ( separator) = & seq. separator {
376
- locs. push ( MatcherLoc :: SequenceSep { separator } ) ;
376
+ locs. push ( MatcherLoc :: SequenceSep { separator : separator . clone ( ) } ) ;
377
377
locs. push ( MatcherLoc :: SequenceKleeneOpAfterSep { idx_first } ) ;
378
378
} else {
379
379
locs. push ( MatcherLoc :: SequenceKleeneOpNoSep { op, idx_first } ) ;
@@ -586,7 +586,7 @@ impl<'tt> TtParser<'tt> {
586
586
pub ( super ) fn parse_tt (
587
587
& mut self ,
588
588
parser : & mut Cow < ' _ , Parser < ' _ > > ,
589
- matcher : & ' tt [ TokenTree ] ,
589
+ matcher : & [ TokenTree ] ,
590
590
) -> NamedParseResult {
591
591
let num_metavar_decls = match self . compute_locs ( parser. sess , matcher) {
592
592
Ok ( num_metavar_decls) => num_metavar_decls,
0 commit comments