@@ -182,15 +182,6 @@ fn ident_can_begin_type(name: Symbol, span: Span, is_raw: bool) -> bool {
182
182
. contains ( & name)
183
183
}
184
184
185
- /// A hack used to pass AST fragments to attribute and derive macros
186
- /// as a single nonterminal token instead of a token stream.
187
- /// FIXME: It needs to be removed, but there are some compatibility issues (see #73345).
188
- #[ derive( Clone , PartialEq , RustcEncodable , RustcDecodable , Debug , HashStable_Generic ) ]
189
- pub enum FlattenGroup {
190
- Yes ,
191
- No ,
192
- }
193
-
194
185
#[ derive( Clone , PartialEq , RustcEncodable , RustcDecodable , Debug , HashStable_Generic ) ]
195
186
pub enum TokenKind {
196
187
/* Expression-operator symbols. */
@@ -245,7 +236,7 @@ pub enum TokenKind {
245
236
/// treat regular and interpolated lifetime identifiers in the same way.
246
237
Lifetime ( Symbol ) ,
247
238
248
- Interpolated ( Lrc < Nonterminal > , FlattenGroup ) ,
239
+ Interpolated ( Lrc < Nonterminal > ) ,
249
240
250
241
// Can be expanded into several tokens.
251
242
/// A doc comment.
@@ -352,7 +343,7 @@ impl Token {
352
343
/// if they keep spans or perform edition checks.
353
344
pub fn uninterpolated_span ( & self ) -> Span {
354
345
match & self . kind {
355
- Interpolated ( nt, _ ) => nt. span ( ) ,
346
+ Interpolated ( nt) => nt. span ( ) ,
356
347
_ => self . span ,
357
348
}
358
349
}
@@ -391,7 +382,7 @@ impl Token {
391
382
ModSep | // global path
392
383
Lifetime ( ..) | // labeled loop
393
384
Pound => true , // expression attributes
394
- Interpolated ( ref nt, _ ) => match * * nt {
385
+ Interpolated ( ref nt) => match * * nt {
395
386
NtLiteral ( ..) |
396
387
NtExpr ( ..) |
397
388
NtBlock ( ..) |
@@ -417,7 +408,7 @@ impl Token {
417
408
Lifetime ( ..) | // lifetime bound in trait object
418
409
Lt | BinOp ( Shl ) | // associated path
419
410
ModSep => true , // global path
420
- Interpolated ( ref nt, _ ) => match * * nt {
411
+ Interpolated ( ref nt) => match * * nt {
421
412
NtTy ( ..) | NtPath ( ..) => true ,
422
413
_ => false ,
423
414
} ,
@@ -429,7 +420,7 @@ impl Token {
429
420
pub fn can_begin_const_arg ( & self ) -> bool {
430
421
match self . kind {
431
422
OpenDelim ( Brace ) => true ,
432
- Interpolated ( ref nt, _ ) => match * * nt {
423
+ Interpolated ( ref nt) => match * * nt {
433
424
NtExpr ( ..) | NtBlock ( ..) | NtLiteral ( ..) => true ,
434
425
_ => false ,
435
426
} ,
@@ -464,7 +455,7 @@ impl Token {
464
455
match self . uninterpolate ( ) . kind {
465
456
Literal ( ..) | BinOp ( Minus ) => true ,
466
457
Ident ( name, false ) if name. is_bool_lit ( ) => true ,
467
- Interpolated ( ref nt, _ ) => match & * * nt {
458
+ Interpolated ( ref nt) => match & * * nt {
468
459
NtLiteral ( _) => true ,
469
460
NtExpr ( e) => match & e. kind {
470
461
ast:: ExprKind :: Lit ( _) => true ,
@@ -485,7 +476,7 @@ impl Token {
485
476
// otherwise returns the original token.
486
477
pub fn uninterpolate ( & self ) -> Cow < ' _ , Token > {
487
478
match & self . kind {
488
- Interpolated ( nt, _ ) => match * * nt {
479
+ Interpolated ( nt) => match * * nt {
489
480
NtIdent ( ident, is_raw) => {
490
481
Cow :: Owned ( Token :: new ( Ident ( ident. name , is_raw) , ident. span ) )
491
482
}
@@ -532,7 +523,7 @@ impl Token {
532
523
533
524
/// Returns `true` if the token is an interpolated path.
534
525
fn is_path ( & self ) -> bool {
535
- if let Interpolated ( ref nt, _ ) = self . kind {
526
+ if let Interpolated ( ref nt) = self . kind {
536
527
if let NtPath ( ..) = * * nt {
537
528
return true ;
538
529
}
@@ -544,7 +535,7 @@ impl Token {
544
535
/// That is, is this a pre-parsed expression dropped into the token stream
545
536
/// (which happens while parsing the result of macro expansion)?
546
537
pub fn is_whole_expr ( & self ) -> bool {
547
- if let Interpolated ( ref nt, _ ) = self . kind {
538
+ if let Interpolated ( ref nt) = self . kind {
548
539
if let NtExpr ( _) | NtLiteral ( _) | NtPath ( _) | NtIdent ( ..) | NtBlock ( _) = * * nt {
549
540
return true ;
550
541
}
@@ -555,7 +546,7 @@ impl Token {
555
546
556
547
// Is the token an interpolated block (`$b:block`)?
557
548
pub fn is_whole_block ( & self ) -> bool {
558
- if let Interpolated ( ref nt, _ ) = self . kind {
549
+ if let Interpolated ( ref nt) = self . kind {
559
550
if let NtBlock ( ..) = * * nt {
560
551
return true ;
561
552
}
0 commit comments