Skip to content

Commit 3f53fba

Browse files
committed
Rename link_compiler to target_compiler
1 parent efbaa77 commit 3f53fba

File tree

5 files changed

+30
-27
lines changed

5 files changed

+30
-27
lines changed

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2200,7 +2200,7 @@ impl Step for Assemble {
22002200
continue;
22012201
}
22022202
builder.ensure(CodegenBackend {
2203-
compilers: RustcPrivateCompilers::from_build_and_link_compiler(
2203+
compilers: RustcPrivateCompilers::from_build_and_target_compiler(
22042204
build_compiler,
22052205
target_compiler,
22062206
),

src/bootstrap/src/core/build_steps/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ impl Step for Miri {
141141

142142
// Get a target sysroot for Miri.
143143
let miri_sysroot =
144-
test::Miri::build_miri_sysroot(builder, compilers.link_compiler(), target);
144+
test::Miri::build_miri_sysroot(builder, compilers.target_compiler(), target);
145145

146146
// # Run miri.
147147
// Running it via `cargo run` as that figures out the right dylib path.

src/bootstrap/src/core/build_steps/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ impl Step for Miri {
548548
// the ui tests also assume cargo-miri has been built
549549
builder.ensure(tool::CargoMiri::from_compilers(compilers));
550550

551-
let target_compiler = compilers.link_compiler();
551+
let target_compiler = compilers.target_compiler();
552552

553553
// We also need sysroots, for Miri and for the host (the latter for build scripts).
554554
// This is for the tests so everything is done with the target compiler.
@@ -773,7 +773,7 @@ impl Step for Clippy {
773773
// that is linked into the clippy being tested. `target_compiler` is the latter,
774774
// and it must also be used by clippy's test runner to build tests and their dependencies.
775775
let compilers = self.compilers;
776-
let target_compiler = compilers.link_compiler();
776+
let target_compiler = compilers.target_compiler();
777777

778778
let tool_result = builder.ensure(tool::Clippy::from_compilers(compilers));
779779
let build_compiler = tool_result.build_compiler;

src/bootstrap/src/core/build_steps/tool.rs

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ impl Step for Rustdoc {
765765
extra_features.push("jemalloc".to_string());
766766
}
767767

768-
let compilers = RustcPrivateCompilers::from_link_compiler(builder, target_compiler);
768+
let compilers = RustcPrivateCompilers::from_target_compiler(builder, target_compiler);
769769
let tool_path = builder
770770
.ensure(ToolBuild {
771771
build_compiler: compilers.build_compiler,
@@ -1133,7 +1133,7 @@ impl Step for RustAnalyzerProcMacroSrv {
11331133

11341134
// Copy `rust-analyzer-proc-macro-srv` to `<sysroot>/libexec/`
11351135
// so that r-a can use it.
1136-
let libexec_path = builder.sysroot(self.compilers.link_compiler).join("libexec");
1136+
let libexec_path = builder.sysroot(self.compilers.target_compiler).join("libexec");
11371137
t!(fs::create_dir_all(&libexec_path));
11381138
builder.copy_link(
11391139
&tool_result.tool_path,
@@ -1294,20 +1294,20 @@ impl Step for LibcxxVersionTool {
12941294
/// that depends on compiler internals (`rustc_private`).
12951295
/// Their compilation looks like this:
12961296
///
1297-
/// - `build_compiler` (stage N-1) builds `link_compiler` (stage N) to produce .rlibs
1297+
/// - `build_compiler` (stage N-1) builds `target_compiler` (stage N) to produce .rlibs
12981298
/// - These .rlibs are copied into the sysroot of `build_compiler`
12991299
/// - `build_compiler` (stage N-1) builds `<tool>` (stage N)
1300-
/// - `<tool>` links to .rlibs from `link_compiler`
1300+
/// - `<tool>` links to .rlibs from `target_compiler`
13011301
///
13021302
/// Eventually, this could also be used for .rmetas and check builds, but so far we only deal with
13031303
/// normal builds here.
13041304
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq)]
13051305
pub struct RustcPrivateCompilers {
1306-
/// Compiler that builds the tool and that builds `link_compiler`.
1306+
/// Compiler that builds the tool and that builds `target_compiler`.
13071307
build_compiler: Compiler,
13081308
/// Compiler to which .rlib artifacts the tool links to.
13091309
/// The host target of this compiler corresponds to the target of the tool.
1310-
link_compiler: Compiler,
1310+
target_compiler: Compiler,
13111311
}
13121312

13131313
impl RustcPrivateCompilers {
@@ -1317,14 +1317,17 @@ impl RustcPrivateCompilers {
13171317
let build_compiler = Self::build_compiler_from_stage(builder, stage);
13181318

13191319
// This is the compiler we'll link to
1320-
// FIXME: make 100% sure that `link_compiler` was indeed built with `build_compiler`...
1321-
let link_compiler = builder.compiler(build_compiler.stage + 1, target);
1320+
// FIXME: make 100% sure that `target_compiler` was indeed built with `build_compiler`...
1321+
let target_compiler = builder.compiler(build_compiler.stage + 1, target);
13221322

1323-
Self { build_compiler, link_compiler }
1323+
Self { build_compiler, target_compiler }
13241324
}
13251325

1326-
pub fn from_build_and_link_compiler(build_compiler: Compiler, link_compiler: Compiler) -> Self {
1327-
Self { build_compiler, link_compiler }
1326+
pub fn from_build_and_target_compiler(
1327+
build_compiler: Compiler,
1328+
target_compiler: Compiler,
1329+
) -> Self {
1330+
Self { build_compiler, target_compiler }
13281331
}
13291332

13301333
/// Create rustc tool compilers from the build compiler.
@@ -1333,15 +1336,15 @@ impl RustcPrivateCompilers {
13331336
build_compiler: Compiler,
13341337
target: TargetSelection,
13351338
) -> Self {
1336-
let link_compiler = builder.compiler(build_compiler.stage + 1, target);
1337-
Self { build_compiler, link_compiler }
1339+
let target_compiler = builder.compiler(build_compiler.stage + 1, target);
1340+
Self { build_compiler, target_compiler }
13381341
}
13391342

1340-
/// Create rustc tool compilers from the link compiler.
1341-
pub fn from_link_compiler(builder: &Builder<'_>, link_compiler: Compiler) -> Self {
1343+
/// Create rustc tool compilers from the target compiler.
1344+
pub fn from_target_compiler(builder: &Builder<'_>, target_compiler: Compiler) -> Self {
13421345
Self {
1343-
build_compiler: Self::build_compiler_from_stage(builder, link_compiler.stage),
1344-
link_compiler,
1346+
build_compiler: Self::build_compiler_from_stage(builder, target_compiler.stage),
1347+
target_compiler,
13451348
}
13461349
}
13471350

@@ -1360,13 +1363,13 @@ impl RustcPrivateCompilers {
13601363
self.build_compiler
13611364
}
13621365

1363-
pub fn link_compiler(&self) -> Compiler {
1364-
self.link_compiler
1366+
pub fn target_compiler(&self) -> Compiler {
1367+
self.target_compiler
13651368
}
13661369

13671370
/// Target of the tool being compiled
13681371
pub fn target(&self) -> TargetSelection {
1369-
self.link_compiler.host
1372+
self.target_compiler.host
13701373
}
13711374
}
13721375

@@ -1494,7 +1497,7 @@ fn build_extended_rustc_tool(
14941497
artifact_kind: ToolArtifactKind::Binary,
14951498
});
14961499

1497-
let target_compiler = compilers.link_compiler;
1500+
let target_compiler = compilers.target_compiler;
14981501
if let Some(add_bins_to_sysroot) = add_bins_to_sysroot
14991502
&& !add_bins_to_sysroot.is_empty()
15001503
{

src/bootstrap/src/core/builder/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,7 @@ You have to build a stage1 compiler for `{}` first, and then use it to build a s
15581558
// FIXME: double check that `run_compiler`'s stage is what we want to use
15591559
let compilers =
15601560
RustcPrivateCompilers::new(self, run_compiler.stage, self.build.host_target);
1561-
assert_eq!(run_compiler, compilers.link_compiler());
1561+
assert_eq!(run_compiler, compilers.target_compiler());
15621562

15631563
let _ = self.ensure(tool::Clippy::from_compilers(compilers));
15641564
let cargo_clippy = self.ensure(tool::CargoClippy::from_compilers(compilers));
@@ -1576,7 +1576,7 @@ You have to build a stage1 compiler for `{}` first, and then use it to build a s
15761576

15771577
let compilers =
15781578
RustcPrivateCompilers::new(self, run_compiler.stage, self.build.host_target);
1579-
assert_eq!(run_compiler, compilers.link_compiler());
1579+
assert_eq!(run_compiler, compilers.target_compiler());
15801580

15811581
// Prepare the tools
15821582
let miri = self.ensure(tool::Miri::from_compilers(compilers));

0 commit comments

Comments
 (0)