@@ -2950,6 +2950,7 @@ impl Item {
29502950 | ItemKind :: GlobalAsm ( _)
29512951 | ItemKind :: MacCall ( _)
29522952 | ItemKind :: Delegation ( _)
2953+ | ItemKind :: DelegationList ( _)
29532954 | ItemKind :: MacroDef ( _) => None ,
29542955 ItemKind :: Static ( _) => None ,
29552956 ItemKind :: Const ( i) => Some ( & i. generics ) ,
@@ -3116,6 +3117,14 @@ pub struct Delegation {
31163117 pub body : Option < P < Block > > ,
31173118}
31183119
3120+ #[ derive( Clone , Encodable , Decodable , Debug ) ]
3121+ pub struct DelegationList {
3122+ pub qself : Option < P < QSelf > > ,
3123+ pub prefix : Path ,
3124+ pub suffixes : ThinVec < Ident > ,
3125+ pub body : Option < P < Block > > ,
3126+ }
3127+
31193128#[ derive( Clone , Encodable , Decodable , Debug ) ]
31203129pub struct StaticItem {
31213130 pub ty : P < Ty > ,
@@ -3202,10 +3211,13 @@ pub enum ItemKind {
32023211 /// A macro definition.
32033212 MacroDef ( MacroDef ) ,
32043213
3205- /// A delegation item (`reuse`).
3214+ /// A single delegation item (`reuse`).
32063215 ///
32073216 /// E.g. `reuse <Type as Trait>::name { target_expr_template }`.
32083217 Delegation ( Box < Delegation > ) ,
3218+ /// A list delegation item (`reuse prefix::{a, b, c}`).
3219+ /// Treated similarly to a macro call and expanded early.
3220+ DelegationList ( Box < DelegationList > ) ,
32093221}
32103222
32113223impl ItemKind {
@@ -3214,7 +3226,7 @@ impl ItemKind {
32143226 match self {
32153227 Use ( ..) | Static ( ..) | Const ( ..) | Fn ( ..) | Mod ( ..) | GlobalAsm ( ..) | TyAlias ( ..)
32163228 | Struct ( ..) | Union ( ..) | Trait ( ..) | TraitAlias ( ..) | MacroDef ( ..)
3217- | Delegation ( ..) => "a" ,
3229+ | Delegation ( ..) | DelegationList ( .. ) => "a" ,
32183230 ExternCrate ( ..) | ForeignMod ( ..) | MacCall ( ..) | Enum ( ..) | Impl { .. } => "an" ,
32193231 }
32203232 }
@@ -3239,6 +3251,7 @@ impl ItemKind {
32393251 ItemKind :: MacroDef ( ..) => "macro definition" ,
32403252 ItemKind :: Impl { .. } => "implementation" ,
32413253 ItemKind :: Delegation ( ..) => "delegated function" ,
3254+ ItemKind :: DelegationList ( ..) => "delegation list" ,
32423255 }
32433256 }
32443257
@@ -3282,6 +3295,8 @@ pub enum AssocItemKind {
32823295 MacCall ( P < MacCall > ) ,
32833296 /// An associated delegation item.
32843297 Delegation ( Box < Delegation > ) ,
3298+ /// An associated delegation item list.
3299+ DelegationList ( Box < DelegationList > ) ,
32853300}
32863301
32873302impl AssocItemKind {
@@ -3290,7 +3305,9 @@ impl AssocItemKind {
32903305 Self :: Const ( box ConstItem { defaultness, .. } )
32913306 | Self :: Fn ( box Fn { defaultness, .. } )
32923307 | Self :: Type ( box TyAlias { defaultness, .. } ) => defaultness,
3293- Self :: MacCall ( ..) | Self :: Delegation ( ..) => Defaultness :: Final ,
3308+ Self :: MacCall ( ..) | Self :: Delegation ( ..) | Self :: DelegationList ( ..) => {
3309+ Defaultness :: Final
3310+ }
32943311 }
32953312 }
32963313}
@@ -3303,6 +3320,7 @@ impl From<AssocItemKind> for ItemKind {
33033320 AssocItemKind :: Type ( ty_alias_kind) => ItemKind :: TyAlias ( ty_alias_kind) ,
33043321 AssocItemKind :: MacCall ( a) => ItemKind :: MacCall ( a) ,
33053322 AssocItemKind :: Delegation ( delegation) => ItemKind :: Delegation ( delegation) ,
3323+ AssocItemKind :: DelegationList ( delegation) => ItemKind :: DelegationList ( delegation) ,
33063324 }
33073325 }
33083326}
@@ -3317,6 +3335,7 @@ impl TryFrom<ItemKind> for AssocItemKind {
33173335 ItemKind :: TyAlias ( ty_kind) => AssocItemKind :: Type ( ty_kind) ,
33183336 ItemKind :: MacCall ( a) => AssocItemKind :: MacCall ( a) ,
33193337 ItemKind :: Delegation ( d) => AssocItemKind :: Delegation ( d) ,
3338+ ItemKind :: DelegationList ( d) => AssocItemKind :: DelegationList ( d) ,
33203339 _ => return Err ( item_kind) ,
33213340 } )
33223341 }
0 commit comments