@@ -3077,7 +3077,7 @@ impl<'hir> TraitItem<'hir> {
3077
3077
}
3078
3078
3079
3079
expect_methods_self_kind ! {
3080
- expect_const, ( & ' hir Ty <' hir>, Option <BodyId >) ,
3080
+ expect_const, ( & ' hir Ty <' hir>, Option <& ' hir ConstArg < ' hir> >) ,
3081
3081
TraitItemKind :: Const ( ty, body) , ( ty, * body) ;
3082
3082
3083
3083
expect_fn, ( & FnSig <' hir>, & TraitFn <' hir>) ,
@@ -3102,7 +3102,7 @@ pub enum TraitFn<'hir> {
3102
3102
#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
3103
3103
pub enum TraitItemKind < ' hir > {
3104
3104
/// 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 > > ) ,
3106
3106
/// An associated function with an optional body.
3107
3107
Fn ( FnSig < ' hir > , TraitFn < ' hir > ) ,
3108
3108
/// An associated type with (possibly empty) bounds and optional concrete
@@ -3152,9 +3152,9 @@ impl<'hir> ImplItem<'hir> {
3152
3152
}
3153
3153
3154
3154
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;
3158
3158
}
3159
3159
}
3160
3160
@@ -3163,7 +3163,7 @@ impl<'hir> ImplItem<'hir> {
3163
3163
pub enum ImplItemKind < ' hir > {
3164
3164
/// An associated constant of the given type, set to the constant result
3165
3165
/// of the expression.
3166
- Const ( & ' hir Ty < ' hir > , BodyId ) ,
3166
+ Const ( & ' hir Ty < ' hir > , & ' hir ConstArg < ' hir > ) ,
3167
3167
/// An associated function implementation with the given signature and body.
3168
3168
Fn ( FnSig < ' hir > , BodyId ) ,
3169
3169
/// An associated type.
@@ -4090,8 +4090,8 @@ impl<'hir> Item<'hir> {
4090
4090
expect_static, ( Ident , & ' hir Ty <' hir>, Mutability , BodyId ) ,
4091
4091
ItemKind :: Static ( ident, ty, mutbl, body) , ( * ident, ty, * mutbl, * body) ;
4092
4092
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 ) ;
4095
4095
4096
4096
expect_fn, ( Ident , & FnSig <' hir>, & ' hir Generics <' hir>, BodyId ) ,
4097
4097
ItemKind :: Fn { ident, sig, generics, body, .. } , ( * ident, sig, generics, * body) ;
@@ -4261,7 +4261,7 @@ pub enum ItemKind<'hir> {
4261
4261
/// A `static` item.
4262
4262
Static ( Ident , & ' hir Ty < ' hir > , Mutability , BodyId ) ,
4263
4263
/// 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 > ) ,
4265
4265
/// A function declaration.
4266
4266
Fn {
4267
4267
ident : Ident ,
@@ -4559,17 +4559,29 @@ impl<'hir> OwnerNode<'hir> {
4559
4559
OwnerNode :: Item ( Item {
4560
4560
kind :
4561
4561
ItemKind :: Static ( _, _, _, body)
4562
- | ItemKind :: Const ( _, _, _, body)
4562
+ | ItemKind :: Const (
4563
+ ..,
4564
+ ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ,
4565
+ )
4563
4566
| ItemKind :: Fn { body, .. } ,
4564
4567
..
4565
4568
} )
4566
4569
| OwnerNode :: TraitItem ( TraitItem {
4567
4570
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
+ ) ,
4569
4576
..
4570
4577
} )
4571
4578
| 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
+ ) ,
4573
4585
..
4574
4586
} ) => Some ( * body) ,
4575
4587
_ => None ,
@@ -4816,20 +4828,32 @@ impl<'hir> Node<'hir> {
4816
4828
Node :: Item ( Item {
4817
4829
owner_id,
4818
4830
kind :
4819
- ItemKind :: Const ( _, _, _, body)
4831
+ ItemKind :: Const (
4832
+ ..,
4833
+ ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ,
4834
+ )
4820
4835
| ItemKind :: Static ( .., body)
4821
4836
| ItemKind :: Fn { body, .. } ,
4822
4837
..
4823
4838
} )
4824
4839
| Node :: TraitItem ( TraitItem {
4825
4840
owner_id,
4826
4841
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) ) ,
4828
4847
..
4829
4848
} )
4830
4849
| Node :: ImplItem ( ImplItem {
4831
4850
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) ,
4833
4857
..
4834
4858
} ) => Some ( ( owner_id. def_id , * body) ) ,
4835
4859
0 commit comments