@@ -379,7 +379,7 @@ impl Token {
379379 match self . uninterpolate ( ) . kind {
380380 Ident ( name, is_raw) =>
381381 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
383383 Literal ( ..) | // literal
384384 Not | // operator not
385385 BinOp ( Minus ) | // unary minus
@@ -394,7 +394,6 @@ impl Token {
394394 Lifetime ( ..) | // labeled loop
395395 Pound => true , // expression attributes
396396 Interpolated ( ref nt) => matches ! ( * * nt, NtLiteral ( ..) |
397- NtExpr ( ..) |
398397 NtBlock ( ..) |
399398 NtPath ( ..) ) ,
400399 _ => false ,
@@ -424,8 +423,8 @@ impl Token {
424423 /// Returns `true` if the token can appear at the start of a const param.
425424 pub fn can_begin_const_arg ( & self ) -> bool {
426425 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 ( ..) ) ,
429428 _ => self . can_begin_literal_maybe_minus ( ) ,
430429 }
431430 }
@@ -454,17 +453,8 @@ impl Token {
454453 match self . uninterpolate ( ) . kind {
455454 Literal ( ..) | BinOp ( Minus ) => true ,
456455 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 ( _) ) ,
468458 _ => false ,
469459 }
470460 }
@@ -541,9 +531,10 @@ impl Token {
541531 /// Would `maybe_whole_expr` in `parser.rs` return `Ok(..)`?
542532 /// That is, is this a pre-parsed expression dropped into the token stream
543533 /// (which happens while parsing the result of macro expansion)?
534+ // njn: need to do anything with this?
544535 pub fn is_whole_expr ( & self ) -> bool {
545536 if let Interpolated ( ref nt) = self . kind
546- && let NtExpr ( _ ) | NtLiteral ( _) | NtPath ( _) | NtBlock ( _) = * * nt
537+ && let NtLiteral ( _) | NtPath ( _) | NtBlock ( _) = * * nt
547538 {
548539 return true ;
549540 }
@@ -699,7 +690,6 @@ pub enum Nonterminal {
699690 NtBlock ( P < ast:: Block > ) ,
700691 NtStmt ( P < ast:: Stmt > ) ,
701692 NtPat ( P < ast:: Pat > ) ,
702- NtExpr ( P < ast:: Expr > ) ,
703693 NtTy ( P < ast:: Ty > ) ,
704694 NtIdent ( Ident , /* is_raw */ bool ) ,
705695 NtLifetime ( Ident ) ,
@@ -799,7 +789,7 @@ impl Nonterminal {
799789 NtBlock ( block) => block. span ,
800790 NtStmt ( stmt) => stmt. span ,
801791 NtPat ( pat) => pat. span ,
802- NtExpr ( expr ) | NtLiteral ( expr) => expr. span ,
792+ NtLiteral ( expr) => expr. span ,
803793 NtTy ( ty) => ty. span ,
804794 NtIdent ( ident, _) | NtLifetime ( ident) => ident. span ,
805795 NtMeta ( attr_item) => attr_item. span ( ) ,
@@ -832,7 +822,6 @@ impl fmt::Debug for Nonterminal {
832822 NtBlock ( ..) => f. pad ( "NtBlock(..)" ) ,
833823 NtStmt ( ..) => f. pad ( "NtStmt(..)" ) ,
834824 NtPat ( ..) => f. pad ( "NtPat(..)" ) ,
835- NtExpr ( ..) => f. pad ( "NtExpr(..)" ) ,
836825 NtTy ( ..) => f. pad ( "NtTy(..)" ) ,
837826 NtIdent ( ..) => f. pad ( "NtIdent(..)" ) ,
838827 NtLiteral ( ..) => f. pad ( "NtLiteral(..)" ) ,
0 commit comments