Skip to content

Commit a8463be

Browse files
committed
compiletest/rmake: simplify path calculations
1 parent 2c867d0 commit a8463be

File tree

1 file changed

+10
-36
lines changed

1 file changed

+10
-36
lines changed

src/tools/compiletest/src/runtest.rs

+10-36
Original file line numberDiff line numberDiff line change
@@ -3540,31 +3540,16 @@ impl<'test> TestCx<'test> {
35403540
// │ └── <host_triple>/release/deps/ // <- deps
35413541
// ```
35423542
//
3543-
// There almost certainly is a better way to do this, but this seems to work for now.
3543+
// FIXME(jieyouxu): there almost certainly is a better way to do this (specifically how the
3544+
// support lib and its deps are organized, can't we copy them to the tools-bin dir as
3545+
// well?), but this seems to work for now.
35443546

3545-
let support_lib_path = {
3546-
let mut p = build_root.clone();
3547-
p.push(format!("{}-tools-bin", stage));
3548-
p.push("librun_make_support.rlib");
3549-
p
3550-
};
3547+
let stage_tools_bin = build_root.join(format!("{stage}-tools-bin"));
3548+
let support_lib_path = stage_tools_bin.join("librun_make_support.rlib");
35513549

3552-
let support_lib_deps = {
3553-
let mut p = build_root.clone();
3554-
p.push(format!("{}-tools", stage));
3555-
p.push(&self.config.host);
3556-
p.push("release");
3557-
p.push("deps");
3558-
p
3559-
};
3560-
3561-
let support_lib_deps_deps = {
3562-
let mut p = build_root.clone();
3563-
p.push(format!("{}-tools", stage));
3564-
p.push("release");
3565-
p.push("deps");
3566-
p
3567-
};
3550+
let stage_tools = build_root.join(format!("{stage}-tools"));
3551+
let support_lib_deps = stage_tools.join(&self.config.host).join("release").join("deps");
3552+
let support_lib_deps_deps = stage_tools.join("release").join("deps");
35683553

35693554
// To compile the recipe with rustc, we need to provide suitable dynamic library search
35703555
// paths to rustc. This includes both:
@@ -3628,13 +3613,7 @@ impl<'test> TestCx<'test> {
36283613
//
36293614
// See <https://github.com/rust-lang/rust/pull/122248> for more background.
36303615
if std::env::var_os("COMPILETEST_FORCE_STAGE0").is_some() {
3631-
let stage0_sysroot = {
3632-
let mut p = build_root.clone();
3633-
p.push("stage0-sysroot");
3634-
p
3635-
};
3636-
debug!(?stage0_sysroot);
3637-
3616+
let stage0_sysroot = build_root.join("stage0-sysroot");
36383617
rustc.arg("--sysroot").arg(&stage0_sysroot);
36393618
}
36403619

@@ -3648,12 +3627,7 @@ impl<'test> TestCx<'test> {
36483627
// provided through env vars.
36493628

36503629
// Compute stage-specific standard library paths.
3651-
let stage_std_path = {
3652-
let mut p = build_root.clone();
3653-
p.push(&stage);
3654-
p.push("lib");
3655-
p
3656-
};
3630+
let stage_std_path = build_root.join(&stage).join("lib");
36573631

36583632
// Compute dynamic library search paths for recipes.
36593633
let recipe_dylib_search_paths = {

0 commit comments

Comments
 (0)