@@ -1044,6 +1044,8 @@ pub(crate) mod parsing {
1044
1044
use super :: * ;
1045
1045
use crate :: parse:: { Parse , ParseStream , Result } ;
1046
1046
use crate :: path;
1047
+ #[ cfg( feature = "full" ) ]
1048
+ use proc_macro2:: TokenTree ;
1047
1049
use std:: cmp:: Ordering ;
1048
1050
1049
1051
crate :: custom_keyword!( raw) ;
@@ -1724,6 +1726,10 @@ pub(crate) mod parsing {
1724
1726
input. call ( expr_block) . map ( Expr :: Block )
1725
1727
} else if input. peek ( Token ! [ ..] ) {
1726
1728
expr_range ( input, allow_struct) . map ( Expr :: Range )
1729
+ } else if input. peek ( Token ! [ _] ) {
1730
+ Ok ( Expr :: Verbatim ( TokenStream :: from (
1731
+ input. parse :: < TokenTree > ( ) ?,
1732
+ ) ) )
1727
1733
} else if input. peek ( Lifetime ) {
1728
1734
let the_label: Label = input. parse ( ) ?;
1729
1735
let mut expr = if input. peek ( Token ! [ while ] ) {
@@ -2451,7 +2457,11 @@ pub(crate) mod parsing {
2451
2457
path,
2452
2458
fields,
2453
2459
dot2_token : Some ( content. parse ( ) ?) ,
2454
- rest : Some ( Box :: new ( content. parse ( ) ?) ) ,
2460
+ rest : if content. is_empty ( ) {
2461
+ None
2462
+ } else {
2463
+ Some ( Box :: new ( content. parse ( ) ?) )
2464
+ } ,
2455
2465
} ) ;
2456
2466
}
2457
2467
@@ -2672,8 +2682,6 @@ pub(crate) mod printing {
2672
2682
use super :: * ;
2673
2683
#[ cfg( feature = "full" ) ]
2674
2684
use crate :: attr:: FilterAttrs ;
2675
- #[ cfg( feature = "full" ) ]
2676
- use crate :: print:: TokensOrDefault ;
2677
2685
use proc_macro2:: { Literal , TokenStream } ;
2678
2686
use quote:: { ToTokens , TokenStreamExt } ;
2679
2687
@@ -3181,10 +3189,12 @@ pub(crate) mod printing {
3181
3189
self . brace_token . surround ( tokens, |tokens| {
3182
3190
inner_attrs_to_tokens ( & self . attrs , tokens) ;
3183
3191
self . fields . to_tokens ( tokens) ;
3184
- if self . rest . is_some ( ) {
3185
- TokensOrDefault ( & self . dot2_token ) . to_tokens ( tokens) ;
3186
- self . rest . to_tokens ( tokens) ;
3192
+ if let Some ( dot2_token) = & self . dot2_token {
3193
+ dot2_token. to_tokens ( tokens) ;
3194
+ } else if self . rest . is_some ( ) {
3195
+ Token ! [ ..] ( Span :: call_site ( ) ) . to_tokens ( tokens) ;
3187
3196
}
3197
+ self . rest . to_tokens ( tokens) ;
3188
3198
} )
3189
3199
}
3190
3200
}
0 commit comments