Skip to content

Commit 01ed951

Browse files
committed
compiletest/rmake: improve clarity of support_lib_{path,deps,deps_deps} calculations
1 parent 2eb8810 commit 01ed951

File tree

1 file changed

+42
-21
lines changed

1 file changed

+42
-21
lines changed

src/tools/compiletest/src/runtest.rs

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3536,29 +3536,50 @@ impl<'test> TestCx<'test> {
35363536
debug!(?self.config.stage_id);
35373537
let stage = self.config.stage_id.split('-').next().unwrap();
35383538

3539-
// First, we construct the path to the built support library.
3540-
// FIXME(jieyouxu): explain what the hecc we are doing here.
3541-
let mut support_lib_path = PathBuf::new();
3542-
support_lib_path.push(&build_root);
3543-
support_lib_path.push(format!("{}-tools-bin", stage));
3544-
support_lib_path.push("librun_make_support.rlib");
3545-
3546-
// FIXME(jieyouxu): explain what the hecc we are doing here.
3547-
let mut support_lib_deps = PathBuf::new();
3548-
support_lib_deps.push(&build_root);
3549-
support_lib_deps.push(format!("{}-tools", stage));
3550-
support_lib_deps.push(&self.config.host);
3551-
support_lib_deps.push("release");
3552-
support_lib_deps.push("deps");
3553-
3554-
// FIXME(jieyouxu): explain what the hecc we are doing here.
3555-
let mut support_lib_deps_deps = PathBuf::new();
3556-
support_lib_deps_deps.push(&build_root);
3557-
support_lib_deps_deps.push(format!("{}-tools", stage));
3558-
support_lib_deps_deps.push("release");
3559-
support_lib_deps_deps.push("deps");
3539+
// In order to link in the support library as a rlib when compiling recipes, we need three
3540+
// paths:
3541+
// 1. Path of the built support library rlib itself.
3542+
// 2. Path of the built support library's dependencies directory.
3543+
// 3. Path of the built support library's dependencies' dependencies directory.
3544+
//
3545+
// The paths look like
3546+
//
3547+
// ```
3548+
// build/<target_tuplet>/
3549+
// ├── stageN-tools-bin/
3550+
// │ └── librun_make_support.rlib // <- support rlib itself
3551+
// ├── stageN-tools/
3552+
// │ ├── release/deps/ // <- deps of deps
3553+
// │ └── <host_tuplet>/release/deps/ // <- deps
3554+
// ```
3555+
//
3556+
// There almost certainly is a better way to do this, but this seems to work for now.
35603557

3558+
let support_lib_path = {
3559+
let mut p = build_root.clone();
3560+
p.push(format!("{}-tools-bin", stage));
3561+
p.push("librun_make_support.rlib");
3562+
p
3563+
};
3564+
debug!(?support_lib_path);
3565+
3566+
let support_lib_deps = {
3567+
let mut p = build_root.clone();
3568+
p.push(format!("{}-tools", stage));
3569+
p.push(&self.config.host);
3570+
p.push("release");
3571+
p.push("deps");
3572+
p
3573+
};
35613574
debug!(?support_lib_deps);
3575+
3576+
let support_lib_deps_deps = {
3577+
let mut p = build_root.clone();
3578+
p.push(format!("{}-tools", stage));
3579+
p.push("release");
3580+
p.push("deps");
3581+
p
3582+
};
35623583
debug!(?support_lib_deps_deps);
35633584

35643585
// FIXME(jieyouxu): explain what the hecc we are doing here.

0 commit comments

Comments
 (0)