Skip to content

Commit f9b1381

Browse files
committed
Rename ToolRustc to ToolRustcPrivate
1 parent f6df223 commit f9b1381

File tree

8 files changed

+89
-67
lines changed

8 files changed

+89
-67
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: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ impl Step for RustAnalyzer {
463463
let mut cargo = tool::prepare_tool_cargo(
464464
builder,
465465
self.compilers.build_compiler(),
466-
Mode::ToolRustc,
466+
Mode::ToolRustcPrivate,
467467
host,
468468
Kind::Test,
469469
crate_path,
@@ -482,7 +482,7 @@ impl Step for RustAnalyzer {
482482
cargo.env("SKIP_SLOW_TESTS", "1");
483483

484484
cargo.add_rustc_lib_path(builder);
485-
run_cargo_test(cargo, &[], &[], "rust-analyzer", host, builder, Mode::ToolRustc);
485+
run_cargo_test(cargo, &[], &[], "rust-analyzer", host, builder, Mode::ToolRustcPrivate);
486486
}
487487

488488
fn metadata(&self) -> Option<StepMetadata> {
@@ -526,7 +526,7 @@ impl Step for Rustfmt {
526526
let mut cargo = tool::prepare_tool_cargo(
527527
builder,
528528
build_compiler,
529-
Mode::ToolRustc,
529+
Mode::ToolRustcPrivate,
530530
target,
531531
Kind::Test,
532532
"src/tools/rustfmt",
@@ -540,7 +540,7 @@ impl Step for Rustfmt {
540540

541541
cargo.add_rustc_lib_path(builder);
542542

543-
run_cargo_test(cargo, &[], &[], "rustfmt", target, builder, Mode::ToolRustc);
543+
run_cargo_test(cargo, &[], &[], "rustfmt", target, builder, Mode::ToolRustcPrivate);
544544
}
545545

546546
fn metadata(&self) -> Option<StepMetadata> {
@@ -579,7 +579,8 @@ impl Miri {
579579
cargo.env("MIRI_SYSROOT", &miri_sysroot);
580580

581581
let mut cargo = BootstrapCommand::from(cargo);
582-
let _guard = builder.msg(Kind::Build, "miri sysroot", Mode::ToolRustc, compiler, target);
582+
let _guard =
583+
builder.msg(Kind::Build, "miri sysroot", Mode::ToolRustcPrivate, compiler, target);
583584
cargo.run(builder);
584585

585586
// # Determine where Miri put its sysroot.
@@ -656,7 +657,7 @@ impl Step for Miri {
656657
let mut cargo = tool::prepare_tool_cargo(
657658
builder,
658659
miri.build_compiler,
659-
Mode::ToolRustc,
660+
Mode::ToolRustcPrivate,
660661
host,
661662
Kind::Test,
662663
"src/tools/miri",
@@ -679,8 +680,13 @@ impl Step for Miri {
679680
cargo.env("MIRI_TEST_TARGET", target.rustc_target_arg());
680681

681682
{
682-
let _guard =
683-
builder.msg(Kind::Test, "miri", Mode::ToolRustc, miri.build_compiler, target);
683+
let _guard = builder.msg(
684+
Kind::Test,
685+
"miri",
686+
Mode::ToolRustcPrivate,
687+
miri.build_compiler,
688+
target,
689+
);
684690
let _time = helpers::timeit(builder);
685691
cargo.run(builder);
686692
}
@@ -699,7 +705,7 @@ impl Step for Miri {
699705
let _guard = builder.msg(
700706
Kind::Test,
701707
"miri (mir-opt-level 4)",
702-
Mode::ToolRustc,
708+
Mode::ToolRustcPrivate,
703709
miri.build_compiler,
704710
target,
705711
);
@@ -772,8 +778,13 @@ impl Step for CargoMiri {
772778
// Finally, run everything.
773779
let mut cargo = BootstrapCommand::from(cargo);
774780
{
775-
let _guard =
776-
builder.msg(Kind::Test, "cargo-miri", Mode::ToolRustc, (host, stage), target);
781+
let _guard = builder.msg(
782+
Kind::Test,
783+
"cargo-miri",
784+
Mode::ToolRustcPrivate,
785+
(host, stage),
786+
target,
787+
);
777788
let _time = helpers::timeit(builder);
778789
cargo.run(builder);
779790
}
@@ -876,7 +887,7 @@ impl Step for Clippy {
876887
let mut cargo = tool::prepare_tool_cargo(
877888
builder,
878889
build_compiler,
879-
Mode::ToolRustc,
890+
Mode::ToolRustcPrivate,
880891
target,
881892
Kind::Test,
882893
"src/tools/clippy",
@@ -887,7 +898,7 @@ impl Step for Clippy {
887898
cargo.env("RUSTC_TEST_SUITE", builder.rustc(build_compiler));
888899
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(build_compiler));
889900
let host_libs =
890-
builder.stage_out(build_compiler, Mode::ToolRustc).join(builder.cargo_dir());
901+
builder.stage_out(build_compiler, Mode::ToolRustcPrivate).join(builder.cargo_dir());
891902
cargo.env("HOST_LIBS", host_libs);
892903

893904
// Build the standard library that the tests can use.
@@ -916,7 +927,8 @@ impl Step for Clippy {
916927
cargo.add_rustc_lib_path(builder);
917928
let cargo = prepare_cargo_test(cargo, &[], &[], target, builder);
918929

919-
let _guard = builder.msg(Kind::Test, "clippy", Mode::ToolRustc, build_compiler, target);
930+
let _guard =
931+
builder.msg(Kind::Test, "clippy", Mode::ToolRustcPrivate, build_compiler, target);
920932

921933
// Clippy reports errors if it blessed the outputs
922934
if cargo.allow_failure().run(builder) {
@@ -2429,7 +2441,7 @@ impl BookTest {
24292441
let libs = if !self.dependencies.is_empty() {
24302442
let mut lib_paths = vec![];
24312443
for dep in self.dependencies {
2432-
let mode = Mode::ToolRustc;
2444+
let mode = Mode::ToolRustcPrivate;
24332445
let target = builder.config.host_target;
24342446
let cargo = tool::prepare_tool_cargo(
24352447
builder,
@@ -3034,7 +3046,7 @@ impl Step for CrateRustdoc {
30343046
let mut cargo = tool::prepare_tool_cargo(
30353047
builder,
30363048
compiler,
3037-
Mode::ToolRustc,
3049+
Mode::ToolRustcPrivate,
30383050
target,
30393051
builder.kind,
30403052
"src/tools/rustdoc",
@@ -3087,7 +3099,7 @@ impl Step for CrateRustdoc {
30873099
"rustdoc",
30883100
target,
30893101
builder,
3090-
Mode::ToolRustc,
3102+
Mode::ToolRustcPrivate,
30913103
);
30923104
}
30933105
}

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,

0 commit comments

Comments
 (0)