@@ -4,10 +4,13 @@ use std::{fmt, mem};
44use either:: { Either , Left , Right } ;
55
66use hir:: CRATE_HIR_ID ;
7+ use rustc_data_structures:: fx:: FxHashMap ;
8+ use rustc_data_structures:: sync:: Lock ;
79use rustc_hir:: { self as hir, def_id:: DefId , definitions:: DefPathData } ;
810use rustc_index:: IndexVec ;
911use rustc_middle:: mir;
1012use rustc_middle:: mir:: interpret:: { ErrorHandled , InvalidMetaKind , ReportedErrorInfo } ;
13+ use rustc_middle:: mir:: ConstValue ;
1114use rustc_middle:: query:: TyCtxtAt ;
1215use rustc_middle:: ty:: layout:: {
1316 self , FnAbiError , FnAbiOfHelpers , FnAbiRequest , LayoutError , LayoutOf , LayoutOfHelpers ,
@@ -47,6 +50,9 @@ pub struct InterpCx<'mir, 'tcx, M: Machine<'mir, 'tcx>> {
4750
4851 /// The recursion limit (cached from `tcx.recursion_limit(())`)
4952 pub recursion_limit : Limit ,
53+
54+ pub const_cache :
55+ Lock < FxHashMap < ( ConstValue < ' tcx > , TyAndLayout < ' tcx > , Span ) , OpTy < ' tcx , M :: Provenance > > > ,
5056}
5157
5258// The Phantomdata exists to prevent this type from being `Send`. If it were sent across a thread
@@ -440,6 +446,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
440446 param_env,
441447 memory : Memory :: new ( ) ,
442448 recursion_limit : tcx. recursion_limit ( ) ,
449+ const_cache : Lock :: new ( FxHashMap :: default ( ) ) ,
443450 }
444451 }
445452
0 commit comments