about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-09-12 18:59:41 +0000
committerbjorn3 <17426603+bjorn3@users.noreply.github.com>2024-11-21 17:44:01 +0000
commit4f213adf09fb52e7c95a7b6d36bc1ca4f09ac9e8 (patch)
tree7cf78482843f3ababdcd256673cda115bb32b2c7
parent1c372caa3354f2b47622f58a734ef10b5075f6c5 (diff)
downloadrust-4f213adf09fb52e7c95a7b6d36bc1ca4f09ac9e8.tar.gz
rust-4f213adf09fb52e7c95a7b6d36bc1ca4f09ac9e8.zip
Inline all RelPath::ensure_fresh
-rw-r--r--build_system/build_sysroot.rs5
-rw-r--r--build_system/path.rs7
-rw-r--r--build_system/tests.rs6
3 files changed, 7 insertions, 11 deletions
diff --git a/build_system/build_sysroot.rs b/build_system/build_sysroot.rs
index f1f4489bcbc..1df1ec72902 100644
--- a/build_system/build_sysroot.rs
+++ b/build_system/build_sysroot.rs
@@ -281,13 +281,14 @@ fn build_rtstartup(dirs: &Dirs, compiler: &Compiler) -> Option<SysrootTarget> {
         return None;
     }
 
-    RTSTARTUP_SYSROOT.ensure_fresh(dirs);
+    let rtstartup_sysroot = RTSTARTUP_SYSROOT.to_path(dirs);
+    ensure_empty_dir(&rtstartup_sysroot);
 
     let rtstartup_src = STDLIB_SRC.to_path(dirs).join("library").join("rtstartup");
     let mut target_libs = SysrootTarget { triple: compiler.triple.clone(), libs: vec![] };
 
     for file in ["rsbegin", "rsend"] {
-        let obj = RTSTARTUP_SYSROOT.to_path(dirs).join(format!("{file}.o"));
+        let obj = rtstartup_sysroot.join(format!("{file}.o"));
         let mut build_rtstartup_cmd = Command::new(&compiler.rustc);
         build_rtstartup_cmd
             .arg("--target")
diff --git a/build_system/path.rs b/build_system/path.rs
index 35e7e81c528..a81902d8470 100644
--- a/build_system/path.rs
+++ b/build_system/path.rs
@@ -1,8 +1,6 @@
 use std::fs;
 use std::path::PathBuf;
 
-use crate::utils::ensure_empty_dir;
-
 #[derive(Debug, Clone)]
 pub(crate) struct Dirs {
     pub(crate) source_dir: PathBuf,
@@ -61,9 +59,4 @@ impl RelPath {
     pub(crate) fn ensure_exists(&self, dirs: &Dirs) {
         fs::create_dir_all(self.to_path(dirs)).unwrap();
     }
-
-    pub(crate) fn ensure_fresh(&self, dirs: &Dirs) {
-        let path = self.to_path(dirs);
-        ensure_empty_dir(&path);
-    }
 }
diff --git a/build_system/tests.rs b/build_system/tests.rs
index fd94e80f631..74fe2fbed4d 100644
--- a/build_system/tests.rs
+++ b/build_system/tests.rs
@@ -7,7 +7,7 @@ use crate::path::{Dirs, RelPath};
 use crate::prepare::{GitRepo, apply_patches};
 use crate::rustc_info::get_default_sysroot;
 use crate::shared_utils::rustflags_from_env;
-use crate::utils::{CargoProject, Compiler, LogGroup, spawn_and_wait};
+use crate::utils::{CargoProject, Compiler, LogGroup, ensure_empty_dir, spawn_and_wait};
 use crate::{CodegenBackend, SysrootKind, build_sysroot, config};
 
 static BUILD_EXAMPLE_OUT_DIR: RelPath = RelPath::BUILD.join("example");
@@ -267,7 +267,9 @@ pub(crate) fn run_tests(
             stdlib_source.clone(),
         );
 
-        BUILD_EXAMPLE_OUT_DIR.ensure_fresh(dirs);
+        let path = BUILD_EXAMPLE_OUT_DIR.to_path(dirs);
+        ensure_empty_dir(&path);
+
         runner.run_testsuite(NO_SYSROOT_SUITE);
     } else {
         eprintln!("[SKIP] no_sysroot tests");