]> git.lizzy.rs Git - rust.git/commitdiff
reorder lets so that build_dir is deleted last
authorRalf Jung <post@ralfj.de>
Sat, 26 Aug 2017 11:23:04 +0000 (13:23 +0200)
committerRalf Jung <post@ralfj.de>
Sat, 26 Aug 2017 11:23:04 +0000 (13:23 +0200)
tests/compiletest.rs

index 93c668e9af49167d58eeffbf340c21bd877d1224..89aa195602e5672daf95eba9b305060736ca2d3c 100644 (file)
@@ -37,9 +37,9 @@ fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, fullmir: b
         path,
         target
     );
+    let build_dir = TempDir::new("miri-tests").unwrap();
     let mut config = compiletest::Config::default();
     config.mode = "compile-fail".parse().expect("Invalid mode");
-    let build_dir = TempDir::new("miri-tests").unwrap();
     config.build_base = build_dir.path().to_owned();
     config.rustc_path = miri_path();
     let mut flags = Vec::new();
@@ -70,9 +70,9 @@ fn compile_fail(sysroot: &Path, path: &str, target: &str, host: &str, fullmir: b
 
 fn run_pass(path: &str) {
     eprintln!("## Running run-pass tests in {} against rustc", path);
+    let build_dir = TempDir::new("miri-tests").unwrap();
     let mut config = compiletest::Config::default();
     config.mode = "run-pass".parse().expect("Invalid mode");
-    let build_dir = TempDir::new("miri-tests").unwrap();
     config.build_base = build_dir.path().to_owned();
     config.src_base = PathBuf::from(path);
     if let Some(rustc_path) = rustc_test_suite() {
@@ -95,9 +95,9 @@ fn miri_pass(path: &str, target: &str, host: &str, fullmir: bool, opt: bool) {
         target,
         opt_str
     );
+    let build_dir = TempDir::new("miri-tests").unwrap();
     let mut config = compiletest::Config::default();
     config.mode = "mir-opt".parse().expect("Invalid mode");
-    let build_dir = TempDir::new("miri-tests").unwrap();
     config.build_base = build_dir.path().to_owned();
     config.src_base = PathBuf::from(path);
     config.target = target.to_owned();