@@ -212,8 +212,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
212
212
} ,
213
213
) ;
214
214
self . lower_define_opaque ( hir_id, & define_opaque) ;
215
- // TODO: make const arg instead of always using None
216
- hir:: ItemKind :: Const ( ident, ty, generics, body_id, None )
215
+ let ct_arg = if self . tcx . features ( ) . min_generic_const_args ( )
216
+ && let Some ( expr) = expr
217
+ {
218
+ self . try_lower_as_const_path ( expr)
219
+ } else {
220
+ None
221
+ } ;
222
+ hir:: ItemKind :: Const ( ident, ty, generics, body_id, ct_arg)
217
223
}
218
224
ItemKind :: Fn ( box Fn {
219
225
sig : FnSig { decl, header, span : fn_sig_span } ,
@@ -814,8 +820,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
814
820
let ty = this
815
821
. lower_ty ( ty, ImplTraitContext :: Disallowed ( ImplTraitPosition :: ConstTy ) ) ;
816
822
let body = expr. as_ref ( ) . map ( |x| this. lower_const_body ( i. span , Some ( x) ) ) ;
817
- // TODO: make const arg instead of always using None
818
- hir:: TraitItemKind :: Const ( ty, body, None )
823
+ let ct_arg = if this. tcx . features ( ) . min_generic_const_args ( )
824
+ && let Some ( expr) = expr
825
+ {
826
+ this. try_lower_as_const_path ( expr)
827
+ } else {
828
+ None
829
+ } ;
830
+ hir:: TraitItemKind :: Const ( ty, body, ct_arg)
819
831
} ,
820
832
) ;
821
833
@@ -1008,8 +1020,14 @@ impl<'hir> LoweringContext<'_, 'hir> {
1008
1020
. lower_ty ( ty, ImplTraitContext :: Disallowed ( ImplTraitPosition :: ConstTy ) ) ;
1009
1021
let body = this. lower_const_body ( i. span , expr. as_deref ( ) ) ;
1010
1022
this. lower_define_opaque ( hir_id, & define_opaque) ;
1011
- // TODO: make const arg instead of always using None
1012
- hir:: ImplItemKind :: Const ( ty, body, None )
1023
+ let ct_arg = if this. tcx . features ( ) . min_generic_const_args ( )
1024
+ && let Some ( expr) = expr
1025
+ {
1026
+ this. try_lower_as_const_path ( expr)
1027
+ } else {
1028
+ None
1029
+ } ;
1030
+ hir:: ImplItemKind :: Const ( ty, body, ct_arg)
1013
1031
} ,
1014
1032
) ,
1015
1033
) ,
0 commit comments