Skip to content

Commit 2ab1462

Browse files
authored
Unrolled build for #146127
Rollup merge of #146127 - Kobzol:rename-tool-rustc, r=jieyouxu Rename `ToolRustc` to `ToolRustcPrivate` I think that this name gets the point across much better. r? ````@jieyouxu````
2 parents 9385c64 + df5896a commit 2ab1462

File tree

9 files changed

+71
-63
lines changed

9 files changed

+71
-63
lines changed

src/bootstrap/src/core/build_steps/check.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ impl Step for Rustc {
389389

390390
/// Represents a compiler that can check something.
391391
///
392-
/// If the compiler was created for `Mode::ToolRustc` or `Mode::Codegen`, it will also contain
392+
/// If the compiler was created for `Mode::ToolRustcPrivate` or `Mode::Codegen`, it will also contain
393393
/// .rmeta artifacts from rustc that was already checked using `build_compiler`.
394394
///
395395
/// All steps that use this struct in a "general way" (i.e. they don't know exactly what kind of
@@ -469,7 +469,7 @@ pub fn prepare_compiler_for_check(
469469
build_compiler
470470
}
471471
}
472-
Mode::ToolRustc | Mode::Codegen => {
472+
Mode::ToolRustcPrivate | Mode::Codegen => {
473473
// Check Rustc to produce the required rmeta artifacts for rustc_private, and then
474474
// return the build compiler that was used to check rustc.
475475
// We do not need to check examples/tests/etc. of Rustc for rustc_private, so we pass
@@ -767,19 +767,22 @@ fn run_tool_check_step(
767767
tool_check_step!(Rustdoc {
768768
path: "src/tools/rustdoc",
769769
alt_path: "src/librustdoc",
770-
mode: |_builder| Mode::ToolRustc
770+
mode: |_builder| Mode::ToolRustcPrivate
771771
});
772772
// Clippy, miri and Rustfmt are hybrids. They are external tools, but use a git subtree instead
773773
// of a submodule. Since the SourceType only drives the deny-warnings
774774
// behavior, treat it as in-tree so that any new warnings in clippy will be
775775
// rejected.
776-
tool_check_step!(Clippy { path: "src/tools/clippy", mode: |_builder| Mode::ToolRustc });
777-
tool_check_step!(Miri { path: "src/tools/miri", mode: |_builder| Mode::ToolRustc });
778-
tool_check_step!(CargoMiri { path: "src/tools/miri/cargo-miri", mode: |_builder| Mode::ToolRustc });
779-
tool_check_step!(Rustfmt { path: "src/tools/rustfmt", mode: |_builder| Mode::ToolRustc });
776+
tool_check_step!(Clippy { path: "src/tools/clippy", mode: |_builder| Mode::ToolRustcPrivate });
777+
tool_check_step!(Miri { path: "src/tools/miri", mode: |_builder| Mode::ToolRustcPrivate });
778+
tool_check_step!(CargoMiri {
779+
path: "src/tools/miri/cargo-miri",
780+
mode: |_builder| Mode::ToolRustcPrivate
781+
});
782+
tool_check_step!(Rustfmt { path: "src/tools/rustfmt", mode: |_builder| Mode::ToolRustcPrivate });
780783
tool_check_step!(RustAnalyzer {
781784
path: "src/tools/rust-analyzer",
782-
mode: |_builder| Mode::ToolRustc,
785+
mode: |_builder| Mode::ToolRustcPrivate,
783786
allow_features: tool::RustAnalyzer::ALLOW_FEATURES,
784787
enable_features: ["in-rust-tree"],
785788
});

src/bootstrap/src/core/build_steps/clippy.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,13 @@ impl Step for CodegenGcc {
366366
);
367367
self.build_compiler.configure_cargo(&mut cargo);
368368

369-
let _guard =
370-
builder.msg(Kind::Clippy, "rustc_codegen_gcc", Mode::ToolRustc, build_compiler, target);
369+
let _guard = builder.msg(
370+
Kind::Clippy,
371+
"rustc_codegen_gcc",
372+
Mode::ToolRustcPrivate,
373+
build_compiler,
374+
target,
375+
);
371376

372377
let stamp = BuildStamp::new(&builder.cargo_out(build_compiler, Mode::Codegen, target))
373378
.with_prefix("rustc_codegen_gcc-check");
@@ -478,23 +483,23 @@ lint_any!(
478483
Bootstrap, "src/bootstrap", "bootstrap", Mode::ToolTarget;
479484
BuildHelper, "src/build_helper", "build_helper", Mode::ToolTarget;
480485
BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::ToolTarget;
481-
CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", Mode::ToolRustc;
482-
Clippy, "src/tools/clippy", "clippy", Mode::ToolRustc;
486+
CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", Mode::ToolRustcPrivate;
487+
Clippy, "src/tools/clippy", "clippy", Mode::ToolRustcPrivate;
483488
CollectLicenseMetadata, "src/tools/collect-license-metadata", "collect-license-metadata", Mode::ToolTarget;
484489
Compiletest, "src/tools/compiletest", "compiletest", Mode::ToolTarget;
485490
CoverageDump, "src/tools/coverage-dump", "coverage-dump", Mode::ToolTarget;
486491
Jsondocck, "src/tools/jsondocck", "jsondocck", Mode::ToolTarget;
487492
Jsondoclint, "src/tools/jsondoclint", "jsondoclint", Mode::ToolTarget;
488493
LintDocs, "src/tools/lint-docs", "lint-docs", Mode::ToolTarget;
489494
LlvmBitcodeLinker, "src/tools/llvm-bitcode-linker", "llvm-bitcode-linker", Mode::ToolTarget;
490-
Miri, "src/tools/miri", "miri", Mode::ToolRustc;
495+
Miri, "src/tools/miri", "miri", Mode::ToolRustcPrivate;
491496
MiroptTestTools, "src/tools/miropt-test-tools", "miropt-test-tools", Mode::ToolTarget;
492497
OptDist, "src/tools/opt-dist", "opt-dist", Mode::ToolTarget;
493498
RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::ToolTarget;
494499
RemoteTestServer, "src/tools/remote-test-server", "remote-test-server", Mode::ToolTarget;
495-
RustAnalyzer, "src/tools/rust-analyzer", "rust-analyzer", Mode::ToolRustc;
496-
Rustdoc, "src/librustdoc", "clippy", Mode::ToolRustc;
497-
Rustfmt, "src/tools/rustfmt", "rustfmt", Mode::ToolRustc;
500+
RustAnalyzer, "src/tools/rust-analyzer", "rust-analyzer", Mode::ToolRustcPrivate;
501+
Rustdoc, "src/librustdoc", "clippy", Mode::ToolRustcPrivate;
502+
Rustfmt, "src/tools/rustfmt", "rustfmt", Mode::ToolRustcPrivate;
498503
RustInstaller, "src/tools/rust-installer", "rust-installer", Mode::ToolTarget;
499504
Tidy, "src/tools/tidy", "tidy", Mode::ToolTarget;
500505
TestFloatParse, "src/tools/test-float-parse", "test-float-parse", Mode::ToolStd;

src/bootstrap/src/core/build_steps/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -995,7 +995,7 @@ macro_rules! tool_doc {
995995
// Build rustc docs so that we generate relative links.
996996
run.builder.ensure(Rustc::from_build_compiler(run.builder, compilers.build_compiler(), target));
997997

998-
(compilers.build_compiler(), Mode::ToolRustc)
998+
(compilers.build_compiler(), Mode::ToolRustcPrivate)
999999
} else {
10001000
// bootstrap/host tools have to be documented with the stage 0 compiler
10011001
(prepare_doc_compiler(run.builder, run.builder.host_target, 1), Mode::ToolBootstrap)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ impl Step for Miri {
161161
let mut miri = tool::prepare_tool_cargo(
162162
builder,
163163
compilers.build_compiler(),
164-
Mode::ToolRustc,
164+
Mode::ToolRustcPrivate,
165165
host,
166166
Kind::Run,
167167
"src/tools/miri",
@@ -487,7 +487,7 @@ impl Step for Rustfmt {
487487
let mut rustfmt = tool::prepare_tool_cargo(
488488
builder,
489489
rustfmt_build.build_compiler,
490-
Mode::ToolRustc,
490+
Mode::ToolRustcPrivate,
491491
host,
492492
Kind::Run,
493493
"src/tools/rustfmt",

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

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ impl Step for RustAnalyzer {
455455
let mut cargo = tool::prepare_tool_cargo(
456456
builder,
457457
self.compilers.build_compiler(),
458-
Mode::ToolRustc,
458+
Mode::ToolRustcPrivate,
459459
host,
460460
Kind::Test,
461461
crate_path,
@@ -518,7 +518,7 @@ impl Step for Rustfmt {
518518
let mut cargo = tool::prepare_tool_cargo(
519519
builder,
520520
build_compiler,
521-
Mode::ToolRustc,
521+
Mode::ToolRustcPrivate,
522522
target,
523523
Kind::Test,
524524
"src/tools/rustfmt",
@@ -571,7 +571,8 @@ impl Miri {
571571
cargo.env("MIRI_SYSROOT", &miri_sysroot);
572572

573573
let mut cargo = BootstrapCommand::from(cargo);
574-
let _guard = builder.msg(Kind::Build, "miri sysroot", Mode::ToolRustc, compiler, target);
574+
let _guard =
575+
builder.msg(Kind::Build, "miri sysroot", Mode::ToolRustcPrivate, compiler, target);
575576
cargo.run(builder);
576577

577578
// # Determine where Miri put its sysroot.
@@ -648,7 +649,7 @@ impl Step for Miri {
648649
let mut cargo = tool::prepare_tool_cargo(
649650
builder,
650651
miri.build_compiler,
651-
Mode::ToolRustc,
652+
Mode::ToolRustcPrivate,
652653
host,
653654
Kind::Test,
654655
"src/tools/miri",
@@ -861,7 +862,7 @@ impl Step for Clippy {
861862
let mut cargo = tool::prepare_tool_cargo(
862863
builder,
863864
build_compiler,
864-
Mode::ToolRustc,
865+
Mode::ToolRustcPrivate,
865866
target,
866867
Kind::Test,
867868
"src/tools/clippy",
@@ -872,7 +873,7 @@ impl Step for Clippy {
872873
cargo.env("RUSTC_TEST_SUITE", builder.rustc(build_compiler));
873874
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(build_compiler));
874875
let host_libs =
875-
builder.stage_out(build_compiler, Mode::ToolRustc).join(builder.cargo_dir());
876+
builder.stage_out(build_compiler, Mode::ToolRustcPrivate).join(builder.cargo_dir());
876877
cargo.env("HOST_LIBS", host_libs);
877878

878879
// Build the standard library that the tests can use.
@@ -2411,7 +2412,7 @@ impl BookTest {
24112412
let libs = if !self.dependencies.is_empty() {
24122413
let mut lib_paths = vec![];
24132414
for dep in self.dependencies {
2414-
let mode = Mode::ToolRustc;
2415+
let mode = Mode::ToolRustcPrivate;
24152416
let target = builder.config.host_target;
24162417
let cargo = tool::prepare_tool_cargo(
24172418
builder,
@@ -2996,7 +2997,7 @@ impl Step for CrateRustdoc {
29962997
let mut cargo = tool::prepare_tool_cargo(
29972998
builder,
29982999
compiler,
2999-
Mode::ToolRustc,
3000+
Mode::ToolRustcPrivate,
30003001
target,
30013002
builder.kind,
30023003
"src/tools/rustdoc",

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl Step for ToolBuild {
8282
let path = self.path;
8383

8484
match self.mode {
85-
Mode::ToolRustc => {
85+
Mode::ToolRustcPrivate => {
8686
// FIXME: remove this, it's only needed for download-rustc...
8787
if !self.build_compiler.is_forced_compiler() && builder.download_rustc() {
8888
builder.std(self.build_compiler, self.build_compiler.host);
@@ -123,7 +123,7 @@ impl Step for ToolBuild {
123123

124124
// Rustc tools (miri, clippy, cargo, rustfmt, rust-analyzer)
125125
// could use the additional optimizations.
126-
if self.mode == Mode::ToolRustc && is_lto_stage(&self.build_compiler) {
126+
if self.mode == Mode::ToolRustcPrivate && is_lto_stage(&self.build_compiler) {
127127
let lto = match builder.config.rust_lto {
128128
RustcLto::Off => Some("off"),
129129
RustcLto::Thin => Some("thin"),
@@ -607,7 +607,7 @@ impl Step for ErrorIndex {
607607
build_compiler: self.compilers.build_compiler,
608608
target: self.compilers.target(),
609609
tool: "error_index_generator",
610-
mode: Mode::ToolRustc,
610+
mode: Mode::ToolRustcPrivate,
611611
path: "src/tools/error_index_generator",
612612
source_type: SourceType::InTree,
613613
extra_features: Vec::new(),
@@ -671,7 +671,7 @@ impl Step for RemoteTestServer {
671671
/// Represents `Rustdoc` that either comes from the external stage0 sysroot or that is built
672672
/// locally.
673673
/// Rustdoc is special, because it both essentially corresponds to a `Compiler` (that can be
674-
/// externally provided), but also to a `ToolRustc` tool.
674+
/// externally provided), but also to a `ToolRustcPrivate` tool.
675675
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
676676
pub struct Rustdoc {
677677
/// If the stage of `target_compiler` is `0`, then rustdoc is externally provided.
@@ -759,7 +759,7 @@ impl Step for Rustdoc {
759759
// the wrong rustdoc being executed. To avoid the conflicting rustdocs, we name the "tool"
760760
// rustdoc a different name.
761761
tool: "rustdoc_tool_binary",
762-
mode: Mode::ToolRustc,
762+
mode: Mode::ToolRustcPrivate,
763763
path: "src/tools/rustdoc",
764764
source_type: SourceType::InTree,
765765
extra_features,
@@ -1048,7 +1048,7 @@ impl Step for RustAnalyzer {
10481048
build_compiler,
10491049
target,
10501050
tool: "rust-analyzer",
1051-
mode: Mode::ToolRustc,
1051+
mode: Mode::ToolRustcPrivate,
10521052
path: "src/tools/rust-analyzer",
10531053
extra_features: vec!["in-rust-tree".to_owned()],
10541054
source_type: SourceType::InTree,
@@ -1105,7 +1105,7 @@ impl Step for RustAnalyzerProcMacroSrv {
11051105
build_compiler: self.compilers.build_compiler,
11061106
target: self.compilers.target(),
11071107
tool: "rust-analyzer-proc-macro-srv",
1108-
mode: Mode::ToolRustc,
1108+
mode: Mode::ToolRustcPrivate,
11091109
path: "src/tools/rust-analyzer/crates/proc-macro-srv-cli",
11101110
extra_features: vec!["in-rust-tree".to_owned()],
11111111
source_type: SourceType::InTree,
@@ -1352,7 +1352,7 @@ impl RustcPrivateCompilers {
13521352
}
13531353
}
13541354

1355-
/// Creates a step that builds an extended `Mode::ToolRustc` tool
1355+
/// Creates a step that builds an extended `Mode::ToolRustcPrivate` tool
13561356
/// and installs it into the sysroot of a corresponding compiler.
13571357
macro_rules! tool_rustc_extended {
13581358
(
@@ -1466,7 +1466,7 @@ fn build_extended_rustc_tool(
14661466
build_compiler,
14671467
target,
14681468
tool: tool_name,
1469-
mode: Mode::ToolRustc,
1469+
mode: Mode::ToolRustcPrivate,
14701470
path,
14711471
extra_features,
14721472
source_type: SourceType::InTree,

src/bootstrap/src/core/builder/cargo.rs

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ impl Builder<'_> {
533533
if cmd_kind == Kind::Doc {
534534
let my_out = match mode {
535535
// This is the intended out directory for compiler documentation.
536-
Mode::Rustc | Mode::ToolRustc | Mode::ToolBootstrap => {
536+
Mode::Rustc | Mode::ToolRustcPrivate | Mode::ToolBootstrap => {
537537
self.compiler_doc_out(target)
538538
}
539539
Mode::Std => {
@@ -583,7 +583,7 @@ impl Builder<'_> {
583583

584584
// We synthetically interpret a stage0 compiler used to build tools as a
585585
// "raw" compiler in that it's the exact snapshot we download. For things like
586-
// ToolRustc, we would have to use the artificial stage0-sysroot compiler instead.
586+
// ToolRustcPrivate, we would have to use the artificial stage0-sysroot compiler instead.
587587
let use_snapshot =
588588
mode == Mode::ToolBootstrap || (mode == Mode::ToolTarget && build_compiler_stage == 0);
589589
assert!(!use_snapshot || build_compiler_stage == 0 || self.local_rebuild);
@@ -643,7 +643,8 @@ impl Builder<'_> {
643643
// sysroot. Passing this cfg enables raw-dylib support instead, which makes the native
644644
// library unnecessary. This can be removed when windows-rs enables raw-dylib
645645
// unconditionally.
646-
if let Mode::Rustc | Mode::ToolRustc | Mode::ToolBootstrap | Mode::ToolTarget = mode {
646+
if let Mode::Rustc | Mode::ToolRustcPrivate | Mode::ToolBootstrap | Mode::ToolTarget = mode
647+
{
647648
rustflags.arg("--cfg=windows_raw_dylib");
648649
}
649650

@@ -657,7 +658,7 @@ impl Builder<'_> {
657658
// - rust-analyzer, due to the rowan crate
658659
// so we exclude an entire category of steps here due to lack of fine-grained control over
659660
// rustflags.
660-
if self.config.rust_randomize_layout && mode != Mode::ToolRustc {
661+
if self.config.rust_randomize_layout && mode != Mode::ToolRustcPrivate {
661662
rustflags.arg("-Zrandomize-layout");
662663
}
663664

@@ -717,7 +718,7 @@ impl Builder<'_> {
717718

718719
match mode {
719720
Mode::Std | Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolTarget => {}
720-
Mode::Rustc | Mode::Codegen | Mode::ToolRustc => {
721+
Mode::Rustc | Mode::Codegen | Mode::ToolRustcPrivate => {
721722
// Build proc macros both for the host and the target unless proc-macros are not
722723
// supported by the target.
723724
if target != compiler.host && cmd_kind != Kind::Check {
@@ -778,7 +779,7 @@ impl Builder<'_> {
778779
"binary-dep-depinfo,proc_macro_span,proc_macro_span_shrink,proc_macro_diagnostic"
779780
.to_string()
780781
}
781-
Mode::Std | Mode::Rustc | Mode::Codegen | Mode::ToolRustc => String::new(),
782+
Mode::Std | Mode::Rustc | Mode::Codegen | Mode::ToolRustcPrivate => String::new(),
782783
};
783784

784785
cargo.arg("-j").arg(self.jobs().to_string());
@@ -825,7 +826,7 @@ impl Builder<'_> {
825826
// rustc step and one that we just built. This isn't always a
826827
// problem, somehow -- not really clear why -- but we know that this
827828
// fixes things.
828-
Mode::ToolRustc => metadata.push_str("tool-rustc"),
829+
Mode::ToolRustcPrivate => metadata.push_str("tool-rustc"),
829830
// Same for codegen backends.
830831
Mode::Codegen => metadata.push_str("codegen"),
831832
_ => {}
@@ -917,7 +918,7 @@ impl Builder<'_> {
917918
let debuginfo_level = match mode {
918919
Mode::Rustc | Mode::Codegen => self.config.rust_debuginfo_level_rustc,
919920
Mode::Std => self.config.rust_debuginfo_level_std,
920-
Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolRustc | Mode::ToolTarget => {
921+
Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolRustcPrivate | Mode::ToolTarget => {
921922
self.config.rust_debuginfo_level_tools
922923
}
923924
};
@@ -930,7 +931,7 @@ impl Builder<'_> {
930931
match mode {
931932
Mode::Std => self.config.std_debug_assertions,
932933
Mode::Rustc | Mode::Codegen => self.config.rustc_debug_assertions,
933-
Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolRustc | Mode::ToolTarget => {
934+
Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolRustcPrivate | Mode::ToolTarget => {
934935
self.config.tools_debug_assertions
935936
}
936937
}
@@ -1005,7 +1006,7 @@ impl Builder<'_> {
10051006
}
10061007
Mode::Std
10071008
| Mode::ToolBootstrap
1008-
| Mode::ToolRustc
1009+
| Mode::ToolRustcPrivate
10091010
| Mode::ToolStd
10101011
| Mode::ToolTarget => {
10111012
if let Some(ref map_to) =
@@ -1078,7 +1079,7 @@ impl Builder<'_> {
10781079
// requirement, but the `-L` library path is not propagated across
10791080
// separate Cargo projects. We can add LLVM's library path to the
10801081
// rustc args as a workaround.
1081-
if (mode == Mode::ToolRustc || mode == Mode::Codegen)
1082+
if (mode == Mode::ToolRustcPrivate || mode == Mode::Codegen)
10821083
&& let Some(llvm_config) = self.llvm_config(target)
10831084
{
10841085
let llvm_libdir =

0 commit comments

Comments
 (0)