@@ -2950,8 +2950,7 @@ impl Item {
2950
2950
| ItemKind :: GlobalAsm ( _)
2951
2951
| ItemKind :: MacCall ( _)
2952
2952
| ItemKind :: Delegation ( _)
2953
- | ItemKind :: DelegationList ( _)
2954
- | ItemKind :: DelegationGlob ( _)
2953
+ | ItemKind :: DelegationMac ( _)
2955
2954
| ItemKind :: MacroDef ( _) => None ,
2956
2955
ItemKind :: Static ( _) => None ,
2957
2956
ItemKind :: Const ( i) => Some ( & i. generics ) ,
@@ -3120,17 +3119,11 @@ pub struct Delegation {
3120
3119
}
3121
3120
3122
3121
#[ derive( Clone , Encodable , Decodable , Debug ) ]
3123
- pub struct DelegationList {
3124
- pub qself : Option < P < QSelf > > ,
3125
- pub prefix : Path ,
3126
- pub suffixes : ThinVec < Ident > ,
3127
- pub body : Option < P < Block > > ,
3128
- }
3129
-
3130
- #[ derive( Clone , Encodable , Decodable , Debug ) ]
3131
- pub struct DelegationGlob {
3122
+ pub struct DelegationMac {
3132
3123
pub qself : Option < P < QSelf > > ,
3133
3124
pub prefix : Path ,
3125
+ // Some for list delegation, and None for glob delegation
3126
+ pub suffixes : Option < ThinVec < Ident > > ,
3134
3127
pub body : Option < P < Block > > ,
3135
3128
}
3136
3129
@@ -3224,12 +3217,9 @@ pub enum ItemKind {
3224
3217
///
3225
3218
/// E.g. `reuse <Type as Trait>::name { target_expr_template }`.
3226
3219
Delegation ( Box < Delegation > ) ,
3227
- /// A list delegation item (`reuse prefix::{a, b, c}`).
3228
- /// Treated similarly to a macro call and expanded early.
3229
- DelegationList ( Box < DelegationList > ) ,
3230
- /// A glob delegation item (`reuse prefix::*`).
3220
+ /// A list or glob delegation item (`reuse prefix::{a, b, c}`, `reuse prefix::*`).
3231
3221
/// Treated similarly to a macro call and expanded early.
3232
- DelegationGlob ( Box < DelegationGlob > ) ,
3222
+ DelegationMac ( Box < DelegationMac > ) ,
3233
3223
}
3234
3224
3235
3225
impl ItemKind {
@@ -3238,7 +3228,7 @@ impl ItemKind {
3238
3228
match self {
3239
3229
Use ( ..) | Static ( ..) | Const ( ..) | Fn ( ..) | Mod ( ..) | GlobalAsm ( ..) | TyAlias ( ..)
3240
3230
| Struct ( ..) | Union ( ..) | Trait ( ..) | TraitAlias ( ..) | MacroDef ( ..)
3241
- | Delegation ( ..) | DelegationList ( .. ) | DelegationGlob ( ..) => "a" ,
3231
+ | Delegation ( ..) | DelegationMac ( ..) => "a" ,
3242
3232
ExternCrate ( ..) | ForeignMod ( ..) | MacCall ( ..) | Enum ( ..) | Impl { .. } => "an" ,
3243
3233
}
3244
3234
}
@@ -3263,8 +3253,7 @@ impl ItemKind {
3263
3253
ItemKind :: MacroDef ( ..) => "macro definition" ,
3264
3254
ItemKind :: Impl { .. } => "implementation" ,
3265
3255
ItemKind :: Delegation ( ..) => "delegated function" ,
3266
- ItemKind :: DelegationList ( ..) => "delegation list" ,
3267
- ItemKind :: DelegationGlob ( ..) => "delegation glob" ,
3256
+ ItemKind :: DelegationMac ( ..) => "delegation" ,
3268
3257
}
3269
3258
}
3270
3259
@@ -3308,10 +3297,8 @@ pub enum AssocItemKind {
3308
3297
MacCall ( P < MacCall > ) ,
3309
3298
/// An associated delegation item.
3310
3299
Delegation ( Box < Delegation > ) ,
3311
- /// An associated delegation item list.
3312
- DelegationList ( Box < DelegationList > ) ,
3313
- /// An associated delegation item glob.
3314
- DelegationGlob ( Box < DelegationGlob > ) ,
3300
+ /// An associated list or glob delegation item.
3301
+ DelegationMac ( Box < DelegationMac > ) ,
3315
3302
}
3316
3303
3317
3304
impl AssocItemKind {
@@ -3322,8 +3309,7 @@ impl AssocItemKind {
3322
3309
| Self :: Type ( box TyAlias { defaultness, .. } ) => defaultness,
3323
3310
Self :: MacCall ( ..)
3324
3311
| Self :: Delegation ( ..)
3325
- | Self :: DelegationList ( ..)
3326
- | Self :: DelegationGlob ( ..) => Defaultness :: Final ,
3312
+ | Self :: DelegationMac ( ..) => Defaultness :: Final ,
3327
3313
}
3328
3314
}
3329
3315
}
@@ -3336,8 +3322,7 @@ impl From<AssocItemKind> for ItemKind {
3336
3322
AssocItemKind :: Type ( ty_alias_kind) => ItemKind :: TyAlias ( ty_alias_kind) ,
3337
3323
AssocItemKind :: MacCall ( a) => ItemKind :: MacCall ( a) ,
3338
3324
AssocItemKind :: Delegation ( delegation) => ItemKind :: Delegation ( delegation) ,
3339
- AssocItemKind :: DelegationList ( delegation) => ItemKind :: DelegationList ( delegation) ,
3340
- AssocItemKind :: DelegationGlob ( delegation) => ItemKind :: DelegationGlob ( delegation) ,
3325
+ AssocItemKind :: DelegationMac ( delegation) => ItemKind :: DelegationMac ( delegation) ,
3341
3326
}
3342
3327
}
3343
3328
}
@@ -3352,8 +3337,7 @@ impl TryFrom<ItemKind> for AssocItemKind {
3352
3337
ItemKind :: TyAlias ( ty_kind) => AssocItemKind :: Type ( ty_kind) ,
3353
3338
ItemKind :: MacCall ( a) => AssocItemKind :: MacCall ( a) ,
3354
3339
ItemKind :: Delegation ( d) => AssocItemKind :: Delegation ( d) ,
3355
- ItemKind :: DelegationList ( d) => AssocItemKind :: DelegationList ( d) ,
3356
- ItemKind :: DelegationGlob ( d) => AssocItemKind :: DelegationGlob ( d) ,
3340
+ ItemKind :: DelegationMac ( d) => AssocItemKind :: DelegationMac ( d) ,
3357
3341
_ => return Err ( item_kind) ,
3358
3342
} )
3359
3343
}
0 commit comments