@@ -3094,7 +3094,7 @@ impl<'hir> TraitItem<'hir> {
30943094 }
30953095
30963096 expect_methods_self_kind ! {
3097- expect_const, ( & ' hir Ty <' hir>, Option <BodyId >) ,
3097+ expect_const, ( & ' hir Ty <' hir>, Option <& ' hir ConstArg < ' hir> >) ,
30983098 TraitItemKind :: Const ( ty, body) , ( ty, * body) ;
30993099
31003100 expect_fn, ( & FnSig <' hir>, & TraitFn <' hir>) ,
@@ -3119,7 +3119,7 @@ pub enum TraitFn<'hir> {
31193119#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
31203120pub enum TraitItemKind < ' hir > {
31213121 /// An associated constant with an optional value (otherwise `impl`s must contain a value).
3122- Const ( & ' hir Ty < ' hir > , Option < BodyId > ) ,
3122+ Const ( & ' hir Ty < ' hir > , Option < & ' hir ConstArg < ' hir > > ) ,
31233123 /// An associated function with an optional body.
31243124 Fn ( FnSig < ' hir > , TraitFn < ' hir > ) ,
31253125 /// An associated type with (possibly empty) bounds and optional concrete
@@ -3169,9 +3169,9 @@ impl<'hir> ImplItem<'hir> {
31693169 }
31703170
31713171 expect_methods_self_kind ! {
3172- expect_const, ( & ' hir Ty <' hir>, BodyId ) , ImplItemKind :: Const ( ty, body) , ( ty, * body) ;
3173- expect_fn, ( & FnSig <' hir>, BodyId ) , ImplItemKind :: Fn ( ty, body) , ( ty, * body) ;
3174- expect_type, & ' hir Ty <' hir>, ImplItemKind :: Type ( ty) , ty;
3172+ expect_const, ( & ' hir Ty <' hir>, & ' hir ConstArg < ' hir> ) , ImplItemKind :: Const ( ty, body) , ( ty, body) ;
3173+ expect_fn, ( & FnSig <' hir>, BodyId ) , ImplItemKind :: Fn ( ty, body) , ( ty, * body) ;
3174+ expect_type, & ' hir Ty <' hir>, ImplItemKind :: Type ( ty) , ty;
31753175 }
31763176}
31773177
@@ -3180,7 +3180,7 @@ impl<'hir> ImplItem<'hir> {
31803180pub enum ImplItemKind < ' hir > {
31813181 /// An associated constant of the given type, set to the constant result
31823182 /// of the expression.
3183- Const ( & ' hir Ty < ' hir > , BodyId ) ,
3183+ Const ( & ' hir Ty < ' hir > , & ' hir ConstArg < ' hir > ) ,
31843184 /// An associated function implementation with the given signature and body.
31853185 Fn ( FnSig < ' hir > , BodyId ) ,
31863186 /// An associated type.
@@ -4107,8 +4107,8 @@ impl<'hir> Item<'hir> {
41074107 expect_static, ( Ident , & ' hir Ty <' hir>, Mutability , BodyId ) ,
41084108 ItemKind :: Static ( ident, ty, mutbl, body) , ( * ident, ty, * mutbl, * body) ;
41094109
4110- expect_const, ( Ident , & ' hir Ty <' hir>, & ' hir Generics <' hir>, BodyId ) ,
4111- ItemKind :: Const ( ident, ty, generics, body ) , ( * ident, ty, generics, * body ) ;
4110+ expect_const, ( Ident , & ' hir Ty <' hir>, & ' hir Generics <' hir>, & ' hir ConstArg < ' hir> ) ,
4111+ ItemKind :: Const ( ident, ty, generics, ct_arg ) , ( * ident, ty, generics, ct_arg ) ;
41124112
41134113 expect_fn, ( Ident , & FnSig <' hir>, & ' hir Generics <' hir>, BodyId ) ,
41144114 ItemKind :: Fn { ident, sig, generics, body, .. } , ( * ident, sig, generics, * body) ;
@@ -4278,7 +4278,7 @@ pub enum ItemKind<'hir> {
42784278 /// A `static` item.
42794279 Static ( Ident , & ' hir Ty < ' hir > , Mutability , BodyId ) ,
42804280 /// A `const` item.
4281- Const ( Ident , & ' hir Ty < ' hir > , & ' hir Generics < ' hir > , BodyId ) ,
4281+ Const ( Ident , & ' hir Ty < ' hir > , & ' hir Generics < ' hir > , & ' hir ConstArg < ' hir > ) ,
42824282 /// A function declaration.
42834283 Fn {
42844284 ident : Ident ,
@@ -4576,17 +4576,29 @@ impl<'hir> OwnerNode<'hir> {
45764576 OwnerNode :: Item ( Item {
45774577 kind :
45784578 ItemKind :: Static ( _, _, _, body)
4579- | ItemKind :: Const ( _, _, _, body)
4579+ | ItemKind :: Const (
4580+ ..,
4581+ ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ,
4582+ )
45804583 | ItemKind :: Fn { body, .. } ,
45814584 ..
45824585 } )
45834586 | OwnerNode :: TraitItem ( TraitItem {
45844587 kind :
4585- TraitItemKind :: Fn ( _, TraitFn :: Provided ( body) ) | TraitItemKind :: Const ( _, Some ( body) ) ,
4588+ TraitItemKind :: Fn ( _, TraitFn :: Provided ( body) )
4589+ | TraitItemKind :: Const (
4590+ _,
4591+ Some ( ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ) ,
4592+ ) ,
45864593 ..
45874594 } )
45884595 | OwnerNode :: ImplItem ( ImplItem {
4589- kind : ImplItemKind :: Fn ( _, body) | ImplItemKind :: Const ( _, body) ,
4596+ kind :
4597+ ImplItemKind :: Fn ( _, body)
4598+ | ImplItemKind :: Const (
4599+ _,
4600+ ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ,
4601+ ) ,
45904602 ..
45914603 } ) => Some ( * body) ,
45924604 _ => None ,
@@ -4833,20 +4845,32 @@ impl<'hir> Node<'hir> {
48334845 Node :: Item ( Item {
48344846 owner_id,
48354847 kind :
4836- ItemKind :: Const ( _, _, _, body)
4848+ ItemKind :: Const (
4849+ ..,
4850+ ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ,
4851+ )
48374852 | ItemKind :: Static ( .., body)
48384853 | ItemKind :: Fn { body, .. } ,
48394854 ..
48404855 } )
48414856 | Node :: TraitItem ( TraitItem {
48424857 owner_id,
48434858 kind :
4844- TraitItemKind :: Const ( _, Some ( body) ) | TraitItemKind :: Fn ( _, TraitFn :: Provided ( body) ) ,
4859+ TraitItemKind :: Const (
4860+ _,
4861+ Some ( ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ) ,
4862+ )
4863+ | TraitItemKind :: Fn ( _, TraitFn :: Provided ( body) ) ,
48454864 ..
48464865 } )
48474866 | Node :: ImplItem ( ImplItem {
48484867 owner_id,
4849- kind : ImplItemKind :: Const ( _, body) | ImplItemKind :: Fn ( _, body) ,
4868+ kind :
4869+ ImplItemKind :: Const (
4870+ _,
4871+ ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ,
4872+ )
4873+ | ImplItemKind :: Fn ( _, body) ,
48504874 ..
48514875 } ) => Some ( ( owner_id. def_id , * body) ) ,
48524876
0 commit comments