File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -452,8 +452,9 @@ impl Token {
452452 }
453453
454454 // 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,
457458 // otherwise returns the original token.
458459 pub fn uninterpolate ( & self ) -> Cow < ' _ , Token > {
459460 match & self . kind {
@@ -462,6 +463,11 @@ impl Token {
462463 Cow :: Owned ( Token :: new ( Ident ( ident. name , is_raw) , ident. span ) )
463464 }
464465 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+ }
465471 _ => Cow :: Borrowed ( self ) ,
466472 } ,
467473 _ => Cow :: Borrowed ( self ) ,
You can’t perform that action at this time.
0 commit comments