File tree 1 file changed +7
-1
lines changed
compiler/rustc_hir_analysis/src
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,7 @@ mod variance;
101
101
use rustc_errors:: ErrorGuaranteed ;
102
102
use rustc_hir as hir;
103
103
use rustc_middle:: middle;
104
+ use rustc_middle:: mir:: interpret:: GlobalId ;
104
105
use rustc_middle:: query:: Providers ;
105
106
use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
106
107
use rustc_middle:: util;
@@ -204,7 +205,12 @@ pub fn check_crate(tcx: TyCtxt<'_>) -> Result<(), ErrorGuaranteed> {
204
205
let def_kind = tcx. def_kind ( item_def_id) ;
205
206
match def_kind {
206
207
DefKind :: Static ( _) => tcx. ensure ( ) . eval_static_initializer ( item_def_id) ,
207
- DefKind :: Const => tcx. ensure ( ) . const_eval_poly ( item_def_id. into ( ) ) ,
208
+ DefKind :: Const if tcx. generics_of ( item_def_id) . params . is_empty ( ) => {
209
+ let instance = ty:: Instance :: new ( item_def_id. into ( ) , ty:: GenericArgs :: empty ( ) ) ;
210
+ let cid = GlobalId { instance, promoted : None } ;
211
+ let param_env = ty:: ParamEnv :: reveal_all ( ) ;
212
+ tcx. ensure ( ) . eval_to_const_value_raw ( param_env. and ( cid) ) ;
213
+ }
208
214
_ => ( ) ,
209
215
}
210
216
} ) ;
You can’t perform that action at this time.
0 commit comments