Skip to content

Commit 4f213ad

Browse files
committed
Inline all RelPath::ensure_fresh
1 parent 1c372ca commit 4f213ad

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

build_system/build_sysroot.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,14 @@ fn build_rtstartup(dirs: &Dirs, compiler: &Compiler) -> Option<SysrootTarget> {
281281
return None;
282282
}
283283

284-
RTSTARTUP_SYSROOT.ensure_fresh(dirs);
284+
let rtstartup_sysroot = RTSTARTUP_SYSROOT.to_path(dirs);
285+
ensure_empty_dir(&rtstartup_sysroot);
285286

286287
let rtstartup_src = STDLIB_SRC.to_path(dirs).join("library").join("rtstartup");
287288
let mut target_libs = SysrootTarget { triple: compiler.triple.clone(), libs: vec![] };
288289

289290
for file in ["rsbegin", "rsend"] {
290-
let obj = RTSTARTUP_SYSROOT.to_path(dirs).join(format!("{file}.o"));
291+
let obj = rtstartup_sysroot.join(format!("{file}.o"));
291292
let mut build_rtstartup_cmd = Command::new(&compiler.rustc);
292293
build_rtstartup_cmd
293294
.arg("--target")

build_system/path.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use std::fs;
22
use std::path::PathBuf;
33

4-
use crate::utils::ensure_empty_dir;
5-
64
#[derive(Debug, Clone)]
75
pub(crate) struct Dirs {
86
pub(crate) source_dir: PathBuf,
@@ -61,9 +59,4 @@ impl RelPath {
6159
pub(crate) fn ensure_exists(&self, dirs: &Dirs) {
6260
fs::create_dir_all(self.to_path(dirs)).unwrap();
6361
}
64-
65-
pub(crate) fn ensure_fresh(&self, dirs: &Dirs) {
66-
let path = self.to_path(dirs);
67-
ensure_empty_dir(&path);
68-
}
6962
}

build_system/tests.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::path::{Dirs, RelPath};
77
use crate::prepare::{GitRepo, apply_patches};
88
use crate::rustc_info::get_default_sysroot;
99
use crate::shared_utils::rustflags_from_env;
10-
use crate::utils::{CargoProject, Compiler, LogGroup, spawn_and_wait};
10+
use crate::utils::{CargoProject, Compiler, LogGroup, ensure_empty_dir, spawn_and_wait};
1111
use crate::{CodegenBackend, SysrootKind, build_sysroot, config};
1212

1313
static BUILD_EXAMPLE_OUT_DIR: RelPath = RelPath::BUILD.join("example");
@@ -267,7 +267,9 @@ pub(crate) fn run_tests(
267267
stdlib_source.clone(),
268268
);
269269

270-
BUILD_EXAMPLE_OUT_DIR.ensure_fresh(dirs);
270+
let path = BUILD_EXAMPLE_OUT_DIR.to_path(dirs);
271+
ensure_empty_dir(&path);
272+
271273
runner.run_testsuite(NO_SYSROOT_SUITE);
272274
} else {
273275
eprintln!("[SKIP] no_sysroot tests");

0 commit comments

Comments
 (0)