@@ -3077,7 +3077,7 @@ impl<'hir> TraitItem<'hir> {
30773077 }
30783078
30793079 expect_methods_self_kind ! {
3080- expect_const, ( & ' hir Ty <' hir>, Option <BodyId >) ,
3080+ expect_const, ( & ' hir Ty <' hir>, Option <& ' hir ConstArg < ' hir> >) ,
30813081 TraitItemKind :: Const ( ty, body) , ( ty, * body) ;
30823082
30833083 expect_fn, ( & FnSig <' hir>, & TraitFn <' hir>) ,
@@ -3102,7 +3102,7 @@ pub enum TraitFn<'hir> {
31023102#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
31033103pub enum TraitItemKind < ' hir > {
31043104 /// An associated constant with an optional value (otherwise `impl`s must contain a value).
3105- Const ( & ' hir Ty < ' hir > , Option < BodyId > ) ,
3105+ Const ( & ' hir Ty < ' hir > , Option < & ' hir ConstArg < ' hir > > ) ,
31063106 /// An associated function with an optional body.
31073107 Fn ( FnSig < ' hir > , TraitFn < ' hir > ) ,
31083108 /// An associated type with (possibly empty) bounds and optional concrete
@@ -3152,9 +3152,9 @@ impl<'hir> ImplItem<'hir> {
31523152 }
31533153
31543154 expect_methods_self_kind ! {
3155- expect_const, ( & ' hir Ty <' hir>, BodyId ) , ImplItemKind :: Const ( ty, body) , ( ty, * body) ;
3156- expect_fn, ( & FnSig <' hir>, BodyId ) , ImplItemKind :: Fn ( ty, body) , ( ty, * body) ;
3157- expect_type, & ' hir Ty <' hir>, ImplItemKind :: Type ( ty) , ty;
3155+ expect_const, ( & ' hir Ty <' hir>, & ' hir ConstArg < ' hir> ) , ImplItemKind :: Const ( ty, body) , ( ty, body) ;
3156+ expect_fn, ( & FnSig <' hir>, BodyId ) , ImplItemKind :: Fn ( ty, body) , ( ty, * body) ;
3157+ expect_type, & ' hir Ty <' hir>, ImplItemKind :: Type ( ty) , ty;
31583158 }
31593159}
31603160
@@ -3163,7 +3163,7 @@ impl<'hir> ImplItem<'hir> {
31633163pub enum ImplItemKind < ' hir > {
31643164 /// An associated constant of the given type, set to the constant result
31653165 /// of the expression.
3166- Const ( & ' hir Ty < ' hir > , BodyId ) ,
3166+ Const ( & ' hir Ty < ' hir > , & ' hir ConstArg < ' hir > ) ,
31673167 /// An associated function implementation with the given signature and body.
31683168 Fn ( FnSig < ' hir > , BodyId ) ,
31693169 /// An associated type.
@@ -4090,8 +4090,8 @@ impl<'hir> Item<'hir> {
40904090 expect_static, ( Ident , & ' hir Ty <' hir>, Mutability , BodyId ) ,
40914091 ItemKind :: Static ( ident, ty, mutbl, body) , ( * ident, ty, * mutbl, * body) ;
40924092
4093- expect_const, ( Ident , & ' hir Ty <' hir>, & ' hir Generics <' hir>, BodyId ) ,
4094- ItemKind :: Const ( ident, ty, generics, body ) , ( * ident, ty, generics, * body ) ;
4093+ expect_const, ( Ident , & ' hir Ty <' hir>, & ' hir Generics <' hir>, & ' hir ConstArg < ' hir> ) ,
4094+ ItemKind :: Const ( ident, ty, generics, ct_arg ) , ( * ident, ty, generics, ct_arg ) ;
40954095
40964096 expect_fn, ( Ident , & FnSig <' hir>, & ' hir Generics <' hir>, BodyId ) ,
40974097 ItemKind :: Fn { ident, sig, generics, body, .. } , ( * ident, sig, generics, * body) ;
@@ -4261,7 +4261,7 @@ pub enum ItemKind<'hir> {
42614261 /// A `static` item.
42624262 Static ( Ident , & ' hir Ty < ' hir > , Mutability , BodyId ) ,
42634263 /// A `const` item.
4264- Const ( Ident , & ' hir Ty < ' hir > , & ' hir Generics < ' hir > , BodyId ) ,
4264+ Const ( Ident , & ' hir Ty < ' hir > , & ' hir Generics < ' hir > , & ' hir ConstArg < ' hir > ) ,
42654265 /// A function declaration.
42664266 Fn {
42674267 ident : Ident ,
@@ -4559,17 +4559,29 @@ impl<'hir> OwnerNode<'hir> {
45594559 OwnerNode :: Item ( Item {
45604560 kind :
45614561 ItemKind :: Static ( _, _, _, body)
4562- | ItemKind :: Const ( _, _, _, body)
4562+ | ItemKind :: Const (
4563+ ..,
4564+ ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ,
4565+ )
45634566 | ItemKind :: Fn { body, .. } ,
45644567 ..
45654568 } )
45664569 | OwnerNode :: TraitItem ( TraitItem {
45674570 kind :
4568- TraitItemKind :: Fn ( _, TraitFn :: Provided ( body) ) | TraitItemKind :: Const ( _, Some ( body) ) ,
4571+ TraitItemKind :: Fn ( _, TraitFn :: Provided ( body) )
4572+ | TraitItemKind :: Const (
4573+ _,
4574+ Some ( ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ) ,
4575+ ) ,
45694576 ..
45704577 } )
45714578 | OwnerNode :: ImplItem ( ImplItem {
4572- kind : ImplItemKind :: Fn ( _, body) | ImplItemKind :: Const ( _, body) ,
4579+ kind :
4580+ ImplItemKind :: Fn ( _, body)
4581+ | ImplItemKind :: Const (
4582+ _,
4583+ ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ,
4584+ ) ,
45734585 ..
45744586 } ) => Some ( * body) ,
45754587 _ => None ,
@@ -4816,20 +4828,32 @@ impl<'hir> Node<'hir> {
48164828 Node :: Item ( Item {
48174829 owner_id,
48184830 kind :
4819- ItemKind :: Const ( _, _, _, body)
4831+ ItemKind :: Const (
4832+ ..,
4833+ ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ,
4834+ )
48204835 | ItemKind :: Static ( .., body)
48214836 | ItemKind :: Fn { body, .. } ,
48224837 ..
48234838 } )
48244839 | Node :: TraitItem ( TraitItem {
48254840 owner_id,
48264841 kind :
4827- TraitItemKind :: Const ( _, Some ( body) ) | TraitItemKind :: Fn ( _, TraitFn :: Provided ( body) ) ,
4842+ TraitItemKind :: Const (
4843+ _,
4844+ Some ( ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ) ,
4845+ )
4846+ | TraitItemKind :: Fn ( _, TraitFn :: Provided ( body) ) ,
48284847 ..
48294848 } )
48304849 | Node :: ImplItem ( ImplItem {
48314850 owner_id,
4832- kind : ImplItemKind :: Const ( _, body) | ImplItemKind :: Fn ( _, body) ,
4851+ kind :
4852+ ImplItemKind :: Const (
4853+ _,
4854+ ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ,
4855+ )
4856+ | ImplItemKind :: Fn ( _, body) ,
48334857 ..
48344858 } ) => Some ( ( owner_id. def_id , * body) ) ,
48354859
0 commit comments