const STATIC_KIND: Option<MiriMemoryKind> = Some(MiriMemoryKind::MutStatic);
- #[inline(always)]
fn enforce_validity(ecx: &EvalContext<'a, 'mir, 'tcx, Self>) -> bool {
- ecx.machine.validate
+ if !ecx.machine.validate {
+ return false;
+ }
+
+ // Some functions are whitelisted until we figure out how to fix them.
+ // We walk up the stack a few frames to also cover their callees.
+ const WHITELIST: &[&str] = &[
+ // Uses mem::uninitialized
+ "std::ptr::read",
+ ];
+ for frame in ecx.stack().iter()
+ .rev().take(3)
+ {
+ let name = frame.instance.to_string();
+ if WHITELIST.iter().any(|white| name.starts_with(white)) {
+ return false;
+ }
+ }
+ true
}
/// Returns Ok() when the function was handled, fail otherwise
flags.push("-Dwarnings -Dunused".to_owned()); // overwrite the -Aunused in compiletest-rs
if have_fullmir() {
flags.push("-Zmiri-start-fn".to_owned());
- // start-fn uses ptr::read, and so fails validation
- flags.push("-Zmiri-disable-validation".to_owned());
}
if opt {
flags.push("-Zmir-opt-level=3".to_owned());
-// FIXME validation disabled because ptr::read uses mem::uninitialized
-// compile-flags: -Zmiri-disable-validation
-
struct Bar;
static mut DROP_COUNT: usize = 0;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// FIXME validation disabled because ptr::read uses mem::uninitialized
-// compile-flags: -Zmiri-disable-validation
-
// zip!(a1,a2,a3,a4) is equivalent to:
// a1.zip(a2).zip(a3).zip(a4).map(|(((x1,x2),x3),x4)| (x1,x2,x3,x4))
macro_rules! zip {
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// FIXME validation disabled because ptr::read uses mem::uninitialized
-// compile-flags: -Zmiri-disable-validation
-
// Test that a class with only sendable fields can be sent
use std::sync::mpsc::channel;
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// FIXME validation disabled because ptr::read uses mem::uninitialized
-// compile-flags: -Zmiri-disable-validation
-
#![feature(box_syntax)]
use std::sync::mpsc::channel;