diff options
| author | 许杰友 Jieyou Xu (Joe) <jieyouxu@outlook.com> | 2024-07-20 09:08:19 +0000 |
|---|---|---|
| committer | 许杰友 Jieyou Xu (Joe) <jieyouxu@outlook.com> | 2024-07-20 09:21:57 +0000 |
| commit | a8463bea91658163c18119b29233505741cc73aa (patch) | |
| tree | 726bca5e9e907a717254b611876ebf41bac5cfaa | |
| parent | 2c867d0b5f630a1e0dea48da93abe806a1816400 (diff) | |
| download | rust-a8463bea91658163c18119b29233505741cc73aa.tar.gz rust-a8463bea91658163c18119b29233505741cc73aa.zip | |
compiletest/rmake: simplify path calculations
| -rw-r--r-- | src/tools/compiletest/src/runtest.rs | 46 |
1 files changed, 10 insertions, 36 deletions
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 9ff9dbba5df..53988203136 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -3540,31 +3540,16 @@ impl<'test> TestCx<'test> { // │ └── <host_triple>/release/deps/ // <- deps // ``` // - // There almost certainly is a better way to do this, but this seems to work for now. + // FIXME(jieyouxu): there almost certainly is a better way to do this (specifically how the + // support lib and its deps are organized, can't we copy them to the tools-bin dir as + // well?), but this seems to work for now. - let support_lib_path = { - let mut p = build_root.clone(); - p.push(format!("{}-tools-bin", stage)); - p.push("librun_make_support.rlib"); - p - }; + let stage_tools_bin = build_root.join(format!("{stage}-tools-bin")); + let support_lib_path = stage_tools_bin.join("librun_make_support.rlib"); - let support_lib_deps = { - let mut p = build_root.clone(); - p.push(format!("{}-tools", stage)); - p.push(&self.config.host); - p.push("release"); - p.push("deps"); - p - }; - - let support_lib_deps_deps = { - let mut p = build_root.clone(); - p.push(format!("{}-tools", stage)); - p.push("release"); - p.push("deps"); - p - }; + let stage_tools = build_root.join(format!("{stage}-tools")); + let support_lib_deps = stage_tools.join(&self.config.host).join("release").join("deps"); + let support_lib_deps_deps = stage_tools.join("release").join("deps"); // To compile the recipe with rustc, we need to provide suitable dynamic library search // paths to rustc. This includes both: @@ -3628,13 +3613,7 @@ impl<'test> TestCx<'test> { // // See <https://github.com/rust-lang/rust/pull/122248> for more background. if std::env::var_os("COMPILETEST_FORCE_STAGE0").is_some() { - let stage0_sysroot = { - let mut p = build_root.clone(); - p.push("stage0-sysroot"); - p - }; - debug!(?stage0_sysroot); - + let stage0_sysroot = build_root.join("stage0-sysroot"); rustc.arg("--sysroot").arg(&stage0_sysroot); } @@ -3648,12 +3627,7 @@ impl<'test> TestCx<'test> { // provided through env vars. // Compute stage-specific standard library paths. - let stage_std_path = { - let mut p = build_root.clone(); - p.push(&stage); - p.push("lib"); - p - }; + let stage_std_path = build_root.join(&stage).join("lib"); // Compute dynamic library search paths for recipes. let recipe_dylib_search_paths = { |
