@@ -76,13 +76,10 @@ pub struct MemoryExtra {
76
76
77
77
/// The random number generator used for resolving non-determinism.
78
78
pub ( crate ) rng : RefCell < StdRng > ,
79
-
80
- /// Whether to enforce the validity invariant.
81
- pub ( crate ) validate : bool ,
82
79
}
83
80
84
81
impl MemoryExtra {
85
- pub fn new ( rng : StdRng , validate : bool , stacked_borrows : bool , tracked_pointer_tag : Option < PtrId > ) -> Self {
82
+ pub fn new ( rng : StdRng , stacked_borrows : bool , tracked_pointer_tag : Option < PtrId > ) -> Self {
86
83
let stacked_borrows = if stacked_borrows {
87
84
Some ( Rc :: new ( RefCell :: new ( stacked_borrows:: GlobalState :: new ( tracked_pointer_tag) ) ) )
88
85
} else {
@@ -92,7 +89,6 @@ impl MemoryExtra {
92
89
stacked_borrows,
93
90
intptrcast : Default :: default ( ) ,
94
91
rng : RefCell :: new ( rng) ,
95
- validate,
96
92
}
97
93
}
98
94
}
@@ -120,6 +116,9 @@ pub struct Evaluator<'tcx> {
120
116
/// and random number generation is delegated to the host.
121
117
pub ( crate ) communicate : bool ,
122
118
119
+ /// Whether to enforce the validity invariant.
120
+ pub ( crate ) validate : bool ,
121
+
123
122
pub ( crate ) file_handler : FileHandler ,
124
123
125
124
/// The temporary used for storing the argument of
@@ -128,7 +127,7 @@ pub struct Evaluator<'tcx> {
128
127
}
129
128
130
129
impl < ' tcx > Evaluator < ' tcx > {
131
- pub ( crate ) fn new ( communicate : bool ) -> Self {
130
+ pub ( crate ) fn new ( communicate : bool , validate : bool ) -> Self {
132
131
Evaluator {
133
132
// `env_vars` could be initialized properly here if `Memory` were available before
134
133
// calling this method.
@@ -139,6 +138,7 @@ impl<'tcx> Evaluator<'tcx> {
139
138
last_error : None ,
140
139
tls : TlsData :: default ( ) ,
141
140
communicate,
141
+ validate,
142
142
file_handler : Default :: default ( ) ,
143
143
panic_payload : None ,
144
144
}
@@ -183,7 +183,7 @@ impl<'mir, 'tcx> Machine<'mir, 'tcx> for Evaluator<'tcx> {
183
183
184
184
#[ inline( always) ]
185
185
fn enforce_validity ( ecx : & InterpCx < ' mir , ' tcx , Self > ) -> bool {
186
- ecx. memory . extra . validate
186
+ ecx. machine . validate
187
187
}
188
188
189
189
#[ inline( always) ]
0 commit comments