File tree 1 file changed +8
-2
lines changed
1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -452,8 +452,9 @@ impl Token {
452
452
}
453
453
454
454
// A convenience function for matching on identifiers during parsing.
455
- // Turns interpolated identifier (`$i: ident`) or lifetime (`$l: lifetime`) token
456
- // into the regular identifier or lifetime token it refers to,
455
+ // Turns interpolated identifier ($i:ident), lifetime ($l:lifetime), and
456
+ // integer literal ($l:literal) into the regular identifier or lifetime or
457
+ // literal token it refers to,
457
458
// otherwise returns the original token.
458
459
pub fn uninterpolate ( & self ) -> Cow < ' _ , Token > {
459
460
match & self . kind {
@@ -462,6 +463,11 @@ impl Token {
462
463
Cow :: Owned ( Token :: new ( Ident ( ident. name , is_raw) , ident. span ) )
463
464
}
464
465
NtLifetime ( ident) => Cow :: Owned ( Token :: new ( Lifetime ( ident. name ) , ident. span ) ) ,
466
+ NtLiteral ( ref literal)
467
+ if let ast:: ExprKind :: Lit ( ast:: Lit { token, kind : ast:: LitKind :: Int ( ..) , .. } ) = literal. kind =>
468
+ {
469
+ Cow :: Owned ( Token :: new ( Literal ( token) , literal. span ) )
470
+ }
465
471
_ => Cow :: Borrowed ( self ) ,
466
472
} ,
467
473
_ => Cow :: Borrowed ( self ) ,
You can’t perform that action at this time.
0 commit comments