@@ -11,6 +11,7 @@ use rustc_hir::lang_items::LangItem;
11
11
use rustc_hir:: ItemKind ;
12
12
use rustc_infer:: infer:: outlives:: env:: OutlivesEnvironment ;
13
13
use rustc_infer:: infer:: { self , InferCtxt , TyCtxtInferExt } ;
14
+ use rustc_middle:: mir:: interpret:: GlobalId ;
14
15
use rustc_middle:: query:: Providers ;
15
16
use rustc_middle:: ty:: print:: with_no_trimmed_paths;
16
17
use rustc_middle:: ty:: trait_def:: TraitSpecializationKind ;
@@ -294,8 +295,13 @@ fn check_item<'tcx>(tcx: TyCtxt<'tcx>, item: &'tcx hir::Item<'tcx>) -> Result<()
294
295
tcx. ensure ( ) . eval_static_initializer ( def_id) ;
295
296
check_item_type ( tcx, def_id, ty. span , UnsizedHandling :: Forbid )
296
297
}
297
- hir:: ItemKind :: Const ( ty, ..) => {
298
- tcx. ensure ( ) . const_eval_poly ( def_id. into ( ) ) ;
298
+ hir:: ItemKind :: Const ( ty, ast_generics, _) => {
299
+ if ast_generics. params . is_empty ( ) {
300
+ let instance = ty:: Instance :: new ( def_id. into ( ) , ty:: GenericArgs :: empty ( ) ) ;
301
+ let cid = GlobalId { instance, promoted : None } ;
302
+ let param_env = ty:: ParamEnv :: reveal_all ( ) ;
303
+ tcx. ensure ( ) . eval_to_const_value_raw ( param_env. and ( cid) ) ;
304
+ }
299
305
check_item_type ( tcx, def_id, ty. span , UnsizedHandling :: Forbid )
300
306
}
301
307
hir:: ItemKind :: Struct ( _, ast_generics) => {
0 commit comments