@@ -4,10 +4,13 @@ use std::{fmt, mem};
4
4
use either:: { Either , Left , Right } ;
5
5
6
6
use hir:: CRATE_HIR_ID ;
7
+ use rustc_data_structures:: fx:: FxHashMap ;
8
+ use rustc_data_structures:: sync:: Lock ;
7
9
use rustc_hir:: { self as hir, def_id:: DefId , definitions:: DefPathData } ;
8
10
use rustc_index:: IndexVec ;
9
11
use rustc_middle:: mir;
10
12
use rustc_middle:: mir:: interpret:: { ErrorHandled , InvalidMetaKind , ReportedErrorInfo } ;
13
+ use rustc_middle:: mir:: ConstValue ;
11
14
use rustc_middle:: query:: TyCtxtAt ;
12
15
use rustc_middle:: ty:: layout:: {
13
16
self , FnAbiError , FnAbiOfHelpers , FnAbiRequest , LayoutError , LayoutOf , LayoutOfHelpers ,
@@ -47,6 +50,9 @@ pub struct InterpCx<'mir, 'tcx, M: Machine<'mir, 'tcx>> {
47
50
48
51
/// The recursion limit (cached from `tcx.recursion_limit(())`)
49
52
pub recursion_limit : Limit ,
53
+
54
+ pub const_cache :
55
+ Lock < FxHashMap < ( ConstValue < ' tcx > , TyAndLayout < ' tcx > , Span ) , OpTy < ' tcx , M :: Provenance > > > ,
50
56
}
51
57
52
58
// 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> {
440
446
param_env,
441
447
memory : Memory :: new ( ) ,
442
448
recursion_limit : tcx. recursion_limit ( ) ,
449
+ const_cache : Lock :: new ( FxHashMap :: default ( ) ) ,
443
450
}
444
451
}
445
452
0 commit comments