@@ -36,7 +36,7 @@ use crate::hir::HirVec;
36
36
use crate :: hir:: map:: { DefKey , DefPathData , Definitions } ;
37
37
use crate :: hir:: def_id:: { DefId , DefIndex , DefIndexAddressSpace , CRATE_DEF_INDEX } ;
38
38
use crate :: hir:: def:: { Def , PathResolution , PerNS } ;
39
- use crate :: hir:: GenericArg ;
39
+ use crate :: hir:: { GenericArg , ConstArg } ;
40
40
use crate :: lint:: builtin:: { self , PARENTHESIZED_PARAMS_IN_TYPES_AND_MODULES ,
41
41
ELIDED_LIFETIMES_IN_PATHS } ;
42
42
use crate :: middle:: cstore:: CrateStore ;
@@ -1172,13 +1172,10 @@ impl<'a> LoweringContext<'a> {
1172
1172
ast:: GenericArg :: Lifetime ( lt) => GenericArg :: Lifetime ( self . lower_lifetime ( & lt) ) ,
1173
1173
ast:: GenericArg :: Type ( ty) => GenericArg :: Type ( self . lower_ty_direct ( & ty, itctx) ) ,
1174
1174
ast:: GenericArg :: Const ( ct) => {
1175
- // FIXME(const_generics): const generics are not yet defined in the HIR.
1176
- self . sess . struct_span_err (
1177
- ct. value . span ,
1178
- "const generics in any position are currently unsupported" ,
1179
- ) . emit ( ) ;
1180
- self . sess . abort_if_errors ( ) ;
1181
- bug ! ( ) ;
1175
+ GenericArg :: Const ( ConstArg {
1176
+ value : self . lower_anon_const ( & ct) ,
1177
+ span : ct. value . span ,
1178
+ } )
1182
1179
}
1183
1180
}
1184
1181
}
@@ -2520,14 +2517,10 @@ impl<'a> LoweringContext<'a> {
2520
2517
2521
2518
( hir:: ParamName :: Plain ( ident) , kind)
2522
2519
}
2523
- GenericParamKind :: Const { .. } => {
2524
- // FIXME(const_generics): const generics are not yet defined in the HIR.
2525
- self . sess . struct_span_err (
2526
- param. ident . span ,
2527
- "const generics in any position are currently unsupported" ,
2528
- ) . emit ( ) ;
2529
- self . sess . abort_if_errors ( ) ;
2530
- bug ! ( ) ;
2520
+ GenericParamKind :: Const { ref ty } => {
2521
+ ( hir:: ParamName :: Plain ( param. ident ) , hir:: GenericParamKind :: Const {
2522
+ ty : self . lower_ty ( & ty, ImplTraitContext :: disallowed ( ) ) ,
2523
+ } )
2531
2524
}
2532
2525
} ;
2533
2526
0 commit comments