Skip to content

Commit 18e7621

Browse files
committed
Inline all RelPath::ensure_fresh
1 parent 81fa34f commit 18e7621

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,7 +1,5 @@
11
use std::path::PathBuf;
22

3-
use crate::utils::ensure_empty_dir;
4-
53
#[derive(Debug, Clone)]
64
pub(crate) struct Dirs {
75
pub(crate) source_dir: PathBuf,
@@ -45,9 +43,4 @@ impl RelPath {
4543
pub(crate) fn to_path(&self, dirs: &Dirs) -> PathBuf {
4644
self.base.to_path(dirs).join(self.suffix)
4745
}
48-
49-
pub(crate) fn ensure_fresh(&self, dirs: &Dirs) {
50-
let path = self.to_path(dirs);
51-
ensure_empty_dir(&path);
52-
}
5346
}

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("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)