@@ -3094,7 +3094,7 @@ impl<'hir> TraitItem<'hir> {
3094
3094
}
3095
3095
3096
3096
expect_methods_self_kind ! {
3097
- expect_const, ( & ' hir Ty <' hir>, Option <BodyId >) ,
3097
+ expect_const, ( & ' hir Ty <' hir>, Option <& ' hir ConstArg < ' hir> >) ,
3098
3098
TraitItemKind :: Const ( ty, body) , ( ty, * body) ;
3099
3099
3100
3100
expect_fn, ( & FnSig <' hir>, & TraitFn <' hir>) ,
@@ -3119,7 +3119,7 @@ pub enum TraitFn<'hir> {
3119
3119
#[ derive( Debug , Clone , Copy , HashStable_Generic ) ]
3120
3120
pub enum TraitItemKind < ' hir > {
3121
3121
/// 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 > > ) ,
3123
3123
/// An associated function with an optional body.
3124
3124
Fn ( FnSig < ' hir > , TraitFn < ' hir > ) ,
3125
3125
/// An associated type with (possibly empty) bounds and optional concrete
@@ -3169,9 +3169,9 @@ impl<'hir> ImplItem<'hir> {
3169
3169
}
3170
3170
3171
3171
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;
3175
3175
}
3176
3176
}
3177
3177
@@ -3180,7 +3180,7 @@ impl<'hir> ImplItem<'hir> {
3180
3180
pub enum ImplItemKind < ' hir > {
3181
3181
/// An associated constant of the given type, set to the constant result
3182
3182
/// of the expression.
3183
- Const ( & ' hir Ty < ' hir > , BodyId ) ,
3183
+ Const ( & ' hir Ty < ' hir > , & ' hir ConstArg < ' hir > ) ,
3184
3184
/// An associated function implementation with the given signature and body.
3185
3185
Fn ( FnSig < ' hir > , BodyId ) ,
3186
3186
/// An associated type.
@@ -4107,8 +4107,8 @@ impl<'hir> Item<'hir> {
4107
4107
expect_static, ( Ident , & ' hir Ty <' hir>, Mutability , BodyId ) ,
4108
4108
ItemKind :: Static ( ident, ty, mutbl, body) , ( * ident, ty, * mutbl, * body) ;
4109
4109
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 ) ;
4112
4112
4113
4113
expect_fn, ( Ident , & FnSig <' hir>, & ' hir Generics <' hir>, BodyId ) ,
4114
4114
ItemKind :: Fn { ident, sig, generics, body, .. } , ( * ident, sig, generics, * body) ;
@@ -4278,7 +4278,7 @@ pub enum ItemKind<'hir> {
4278
4278
/// A `static` item.
4279
4279
Static ( Ident , & ' hir Ty < ' hir > , Mutability , BodyId ) ,
4280
4280
/// 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 > ) ,
4282
4282
/// A function declaration.
4283
4283
Fn {
4284
4284
ident : Ident ,
@@ -4576,17 +4576,29 @@ impl<'hir> OwnerNode<'hir> {
4576
4576
OwnerNode :: Item ( Item {
4577
4577
kind :
4578
4578
ItemKind :: Static ( _, _, _, body)
4579
- | ItemKind :: Const ( _, _, _, body)
4579
+ | ItemKind :: Const (
4580
+ ..,
4581
+ ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ,
4582
+ )
4580
4583
| ItemKind :: Fn { body, .. } ,
4581
4584
..
4582
4585
} )
4583
4586
| OwnerNode :: TraitItem ( TraitItem {
4584
4587
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
+ ) ,
4586
4593
..
4587
4594
} )
4588
4595
| 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
+ ) ,
4590
4602
..
4591
4603
} ) => Some ( * body) ,
4592
4604
_ => None ,
@@ -4833,20 +4845,32 @@ impl<'hir> Node<'hir> {
4833
4845
Node :: Item ( Item {
4834
4846
owner_id,
4835
4847
kind :
4836
- ItemKind :: Const ( _, _, _, body)
4848
+ ItemKind :: Const (
4849
+ ..,
4850
+ ConstArg { kind : ConstArgKind :: Anon ( AnonConst { body, .. } ) , .. } ,
4851
+ )
4837
4852
| ItemKind :: Static ( .., body)
4838
4853
| ItemKind :: Fn { body, .. } ,
4839
4854
..
4840
4855
} )
4841
4856
| Node :: TraitItem ( TraitItem {
4842
4857
owner_id,
4843
4858
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) ) ,
4845
4864
..
4846
4865
} )
4847
4866
| Node :: ImplItem ( ImplItem {
4848
4867
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) ,
4850
4874
..
4851
4875
} ) => Some ( ( owner_id. def_id , * body) ) ,
4852
4876
0 commit comments