]> git.lizzy.rs Git - rust.git/commitdiff
with the new 'limited validation when there is unsafe', we can significantly shrink...
authorRalf Jung <post@ralfj.de>
Wed, 2 Aug 2017 02:48:44 +0000 (19:48 -0700)
committerRalf Jung <post@ralfj.de>
Fri, 4 Aug 2017 01:12:26 +0000 (18:12 -0700)
miri/bin/miri.rs
src/librustc_mir/interpret/validation.rs

index 76a9b3d0e051aa82095bfae0c626203b5204069d..0730315504a5a2efa9eaaf4833cd033b5394697f 100644 (file)
@@ -202,7 +202,7 @@ fn main() {
 
     // for auxilary builds in unit tests
     args.push("-Zalways-encode-mir".to_owned());
-    args.push("-Zmir-emit-validate".to_owned());
+    args.push("-Zmir-emit-validate=1".to_owned());
 
     rustc_driver::run_compiler(&args, &mut MiriCompilerCalls(RustcDefaultCalls), None, None);
 }
index 3756fca2344f343352ebe99ab1775472060833aa..a6c2871cf521a08883da831e5eaece2199e27b50 100644 (file)
@@ -40,24 +40,19 @@ fn acquiring(self) -> bool {
 impl<'a, 'tcx, M: Machine<'tcx>> EvalContext<'a, 'tcx, M> {
     pub(crate) fn validation_op(&mut self, op: ValidationOp, operand: &ValidationOperand<'tcx, mir::Lvalue<'tcx>>) -> EvalResult<'tcx> {
         // HACK: Determine if this method is whitelisted and hence we do not perform any validation.
+        // We currently insta-UB on anything passing around uninitialized memory, so we have to whitelist
+        // the places that are allowed to do that.
         {
             // The regexp we use for filtering
             use regex::Regex;
             lazy_static! {
                 static ref RE: Regex = Regex::new("^(\
-std::mem::swap::|\
 std::mem::uninitialized::|\
-std::ptr::read::|\
-std::panicking::try::do_call::|\
-std::slice::from_raw_parts_mut::|\
+std::mem::forget::|\
 <std::heap::Heap as std::heap::Alloc>::|\
-<std::mem::ManuallyDrop<T>><std::heap::AllocErr>::new$|\
-<std::mem::ManuallyDrop<T> as std::ops::DerefMut><std::heap::AllocErr>::deref_mut$|\
-std::sync::atomic::AtomicBool::get_mut$|\
-<std::boxed::Box<T>><[a-zA-Z0-9_\\[\\]]+>::from_raw|\
-<[a-zA-Z0-9_:<>]+ as std::slice::SliceIndex<[a-zA-Z0-9_\\[\\]]+>><[a-zA-Z0-9_\\[\\]]+>::get_unchecked_mut$|\
-<alloc::raw_vec::RawVec<T, std::heap::Heap>><[a-zA-Z0-9_\\[\\]]+>::into_box$|\
-<std::vec::Vec<T>><[a-zA-Z0-9_\\[\\]]+>::into_boxed_slice$\
+<std::mem::ManuallyDrop<T>><.*>::new$|\
+<std::mem::ManuallyDrop<T> as std::ops::DerefMut><.*>::deref_mut$|\
+std::ptr::read::\
 )").unwrap();
             }
             // Now test