@@ -379,7 +379,7 @@ impl Token {
379
379
match self . uninterpolate ( ) . kind {
380
380
Ident ( name, is_raw) =>
381
381
ident_can_begin_expr ( name, self . span , is_raw) , // value name or keyword
382
- OpenDelim ( ..) | // tuple, array or block
382
+ OpenDelim ( ..) | // tuple, array, block, or macro output
383
383
Literal ( ..) | // literal
384
384
Not | // operator not
385
385
BinOp ( Minus ) | // unary minus
@@ -394,7 +394,6 @@ impl Token {
394
394
Lifetime ( ..) | // labeled loop
395
395
Pound => true , // expression attributes
396
396
Interpolated ( ref nt) => matches ! ( * * nt, NtLiteral ( ..) |
397
- NtExpr ( ..) |
398
397
NtBlock ( ..) |
399
398
NtPath ( ..) ) ,
400
399
_ => false ,
@@ -424,8 +423,8 @@ impl Token {
424
423
/// Returns `true` if the token can appear at the start of a const param.
425
424
pub fn can_begin_const_arg ( & self ) -> bool {
426
425
match self . kind {
427
- OpenDelim ( Delimiter :: Brace ) => true ,
428
- Interpolated ( ref nt) => matches ! ( * * nt, NtExpr ( .. ) | NtBlock ( ..) | NtLiteral ( ..) ) ,
426
+ OpenDelim ( Delimiter :: Brace | Delimiter :: Invisible { .. } ) => true ,
427
+ Interpolated ( ref nt) => matches ! ( * * nt, NtBlock ( ..) | NtLiteral ( ..) ) ,
429
428
_ => self . can_begin_literal_maybe_minus ( ) ,
430
429
}
431
430
}
@@ -454,17 +453,8 @@ impl Token {
454
453
match self . uninterpolate ( ) . kind {
455
454
Literal ( ..) | BinOp ( Minus ) => true ,
456
455
Ident ( name, false ) if name. is_bool_lit ( ) => true ,
457
- Interpolated ( ref nt) => match & * * nt {
458
- NtLiteral ( _) => true ,
459
- NtExpr ( e) => match & e. kind {
460
- ast:: ExprKind :: Lit ( _) => true ,
461
- ast:: ExprKind :: Unary ( ast:: UnOp :: Neg , e) => {
462
- matches ! ( & e. kind, ast:: ExprKind :: Lit ( _) )
463
- }
464
- _ => false ,
465
- } ,
466
- _ => false ,
467
- } ,
456
+ OpenDelim ( Delimiter :: Invisible { .. } ) => true ,
457
+ Interpolated ( ref nt) => matches ! ( * * nt, NtLiteral ( _) ) ,
468
458
_ => false ,
469
459
}
470
460
}
@@ -541,9 +531,10 @@ impl Token {
541
531
/// Would `maybe_whole_expr` in `parser.rs` return `Ok(..)`?
542
532
/// That is, is this a pre-parsed expression dropped into the token stream
543
533
/// (which happens while parsing the result of macro expansion)?
534
+ // njn: need to do anything with this?
544
535
pub fn is_whole_expr ( & self ) -> bool {
545
536
if let Interpolated ( ref nt) = self . kind
546
- && let NtExpr ( _ ) | NtLiteral ( _) | NtPath ( _) | NtBlock ( _) = * * nt
537
+ && let NtLiteral ( _) | NtPath ( _) | NtBlock ( _) = * * nt
547
538
{
548
539
return true ;
549
540
}
@@ -699,7 +690,6 @@ pub enum Nonterminal {
699
690
NtBlock ( P < ast:: Block > ) ,
700
691
NtStmt ( P < ast:: Stmt > ) ,
701
692
NtPat ( P < ast:: Pat > ) ,
702
- NtExpr ( P < ast:: Expr > ) ,
703
693
NtTy ( P < ast:: Ty > ) ,
704
694
NtIdent ( Ident , /* is_raw */ bool ) ,
705
695
NtLifetime ( Ident ) ,
@@ -799,7 +789,7 @@ impl Nonterminal {
799
789
NtBlock ( block) => block. span ,
800
790
NtStmt ( stmt) => stmt. span ,
801
791
NtPat ( pat) => pat. span ,
802
- NtExpr ( expr ) | NtLiteral ( expr) => expr. span ,
792
+ NtLiteral ( expr) => expr. span ,
803
793
NtTy ( ty) => ty. span ,
804
794
NtIdent ( ident, _) | NtLifetime ( ident) => ident. span ,
805
795
NtMeta ( attr_item) => attr_item. span ( ) ,
@@ -832,7 +822,6 @@ impl fmt::Debug for Nonterminal {
832
822
NtBlock ( ..) => f. pad ( "NtBlock(..)" ) ,
833
823
NtStmt ( ..) => f. pad ( "NtStmt(..)" ) ,
834
824
NtPat ( ..) => f. pad ( "NtPat(..)" ) ,
835
- NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
836
825
NtTy ( ..) => f. pad ( "NtTy(..)" ) ,
837
826
NtIdent ( ..) => f. pad ( "NtIdent(..)" ) ,
838
827
NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
0 commit comments