Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions src/bootstrap/src/core/build_steps/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ impl Step for Rustc {

/// Represents a compiler that can check something.
///
/// If the compiler was created for `Mode::ToolRustc` or `Mode::Codegen`, it will also contain
/// If the compiler was created for `Mode::ToolRustcPrivate` or `Mode::Codegen`, it will also contain
/// .rmeta artifacts from rustc that was already checked using `build_compiler`.
///
/// All steps that use this struct in a "general way" (i.e. they don't know exactly what kind of
Expand Down Expand Up @@ -469,7 +469,7 @@ pub fn prepare_compiler_for_check(
build_compiler
}
}
Mode::ToolRustc | Mode::Codegen => {
Mode::ToolRustcPrivate | Mode::Codegen => {
// Check Rustc to produce the required rmeta artifacts for rustc_private, and then
// return the build compiler that was used to check rustc.
// We do not need to check examples/tests/etc. of Rustc for rustc_private, so we pass
Expand Down Expand Up @@ -767,19 +767,22 @@ fn run_tool_check_step(
tool_check_step!(Rustdoc {
path: "src/tools/rustdoc",
alt_path: "src/librustdoc",
mode: |_builder| Mode::ToolRustc
mode: |_builder| Mode::ToolRustcPrivate
});
// Clippy, miri and Rustfmt are hybrids. They are external tools, but use a git subtree instead
// of a submodule. Since the SourceType only drives the deny-warnings
// behavior, treat it as in-tree so that any new warnings in clippy will be
// rejected.
tool_check_step!(Clippy { path: "src/tools/clippy", mode: |_builder| Mode::ToolRustc });
tool_check_step!(Miri { path: "src/tools/miri", mode: |_builder| Mode::ToolRustc });
tool_check_step!(CargoMiri { path: "src/tools/miri/cargo-miri", mode: |_builder| Mode::ToolRustc });
tool_check_step!(Rustfmt { path: "src/tools/rustfmt", mode: |_builder| Mode::ToolRustc });
tool_check_step!(Clippy { path: "src/tools/clippy", mode: |_builder| Mode::ToolRustcPrivate });
tool_check_step!(Miri { path: "src/tools/miri", mode: |_builder| Mode::ToolRustcPrivate });
tool_check_step!(CargoMiri {
path: "src/tools/miri/cargo-miri",
mode: |_builder| Mode::ToolRustcPrivate
});
tool_check_step!(Rustfmt { path: "src/tools/rustfmt", mode: |_builder| Mode::ToolRustcPrivate });
tool_check_step!(RustAnalyzer {
path: "src/tools/rust-analyzer",
mode: |_builder| Mode::ToolRustc,
mode: |_builder| Mode::ToolRustcPrivate,
allow_features: tool::RustAnalyzer::ALLOW_FEATURES,
enable_features: ["in-rust-tree"],
});
Expand Down
21 changes: 13 additions & 8 deletions src/bootstrap/src/core/build_steps/clippy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,13 @@ impl Step for CodegenGcc {
);
self.build_compiler.configure_cargo(&mut cargo);

let _guard =
builder.msg(Kind::Clippy, "rustc_codegen_gcc", Mode::ToolRustc, build_compiler, target);
let _guard = builder.msg(
Kind::Clippy,
"rustc_codegen_gcc",
Mode::ToolRustcPrivate,
build_compiler,
target,
);

let stamp = BuildStamp::new(&builder.cargo_out(build_compiler, Mode::Codegen, target))
.with_prefix("rustc_codegen_gcc-check");
Expand Down Expand Up @@ -478,23 +483,23 @@ lint_any!(
Bootstrap, "src/bootstrap", "bootstrap", Mode::ToolTarget;
BuildHelper, "src/build_helper", "build_helper", Mode::ToolTarget;
BuildManifest, "src/tools/build-manifest", "build-manifest", Mode::ToolTarget;
CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", Mode::ToolRustc;
Clippy, "src/tools/clippy", "clippy", Mode::ToolRustc;
CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", Mode::ToolRustcPrivate;
Clippy, "src/tools/clippy", "clippy", Mode::ToolRustcPrivate;
CollectLicenseMetadata, "src/tools/collect-license-metadata", "collect-license-metadata", Mode::ToolTarget;
Compiletest, "src/tools/compiletest", "compiletest", Mode::ToolTarget;
CoverageDump, "src/tools/coverage-dump", "coverage-dump", Mode::ToolTarget;
Jsondocck, "src/tools/jsondocck", "jsondocck", Mode::ToolTarget;
Jsondoclint, "src/tools/jsondoclint", "jsondoclint", Mode::ToolTarget;
LintDocs, "src/tools/lint-docs", "lint-docs", Mode::ToolTarget;
LlvmBitcodeLinker, "src/tools/llvm-bitcode-linker", "llvm-bitcode-linker", Mode::ToolTarget;
Miri, "src/tools/miri", "miri", Mode::ToolRustc;
Miri, "src/tools/miri", "miri", Mode::ToolRustcPrivate;
MiroptTestTools, "src/tools/miropt-test-tools", "miropt-test-tools", Mode::ToolTarget;
OptDist, "src/tools/opt-dist", "opt-dist", Mode::ToolTarget;
RemoteTestClient, "src/tools/remote-test-client", "remote-test-client", Mode::ToolTarget;
RemoteTestServer, "src/tools/remote-test-server", "remote-test-server", Mode::ToolTarget;
RustAnalyzer, "src/tools/rust-analyzer", "rust-analyzer", Mode::ToolRustc;
Rustdoc, "src/librustdoc", "clippy", Mode::ToolRustc;
Rustfmt, "src/tools/rustfmt", "rustfmt", Mode::ToolRustc;
RustAnalyzer, "src/tools/rust-analyzer", "rust-analyzer", Mode::ToolRustcPrivate;
Rustdoc, "src/librustdoc", "clippy", Mode::ToolRustcPrivate;
Rustfmt, "src/tools/rustfmt", "rustfmt", Mode::ToolRustcPrivate;
RustInstaller, "src/tools/rust-installer", "rust-installer", Mode::ToolTarget;
Tidy, "src/tools/tidy", "tidy", Mode::ToolTarget;
TestFloatParse, "src/tools/test-float-parse", "test-float-parse", Mode::ToolStd;
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/src/core/build_steps/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -995,7 +995,7 @@ macro_rules! tool_doc {
// Build rustc docs so that we generate relative links.
run.builder.ensure(Rustc::from_build_compiler(run.builder, compilers.build_compiler(), target));

(compilers.build_compiler(), Mode::ToolRustc)
(compilers.build_compiler(), Mode::ToolRustcPrivate)
} else {
// bootstrap/host tools have to be documented with the stage 0 compiler
(prepare_doc_compiler(run.builder, run.builder.host_target, 1), Mode::ToolBootstrap)
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/src/core/build_steps/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl Step for Miri {
let mut miri = tool::prepare_tool_cargo(
builder,
compilers.build_compiler(),
Mode::ToolRustc,
Mode::ToolRustcPrivate,
host,
Kind::Run,
"src/tools/miri",
Expand Down Expand Up @@ -487,7 +487,7 @@ impl Step for Rustfmt {
let mut rustfmt = tool::prepare_tool_cargo(
builder,
rustfmt_build.build_compiler,
Mode::ToolRustc,
Mode::ToolRustcPrivate,
host,
Kind::Run,
"src/tools/rustfmt",
Expand Down
17 changes: 9 additions & 8 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ impl Step for RustAnalyzer {
let mut cargo = tool::prepare_tool_cargo(
builder,
self.compilers.build_compiler(),
Mode::ToolRustc,
Mode::ToolRustcPrivate,
host,
Kind::Test,
crate_path,
Expand Down Expand Up @@ -518,7 +518,7 @@ impl Step for Rustfmt {
let mut cargo = tool::prepare_tool_cargo(
builder,
build_compiler,
Mode::ToolRustc,
Mode::ToolRustcPrivate,
target,
Kind::Test,
"src/tools/rustfmt",
Expand Down Expand Up @@ -571,7 +571,8 @@ impl Miri {
cargo.env("MIRI_SYSROOT", &miri_sysroot);

let mut cargo = BootstrapCommand::from(cargo);
let _guard = builder.msg(Kind::Build, "miri sysroot", Mode::ToolRustc, compiler, target);
let _guard =
builder.msg(Kind::Build, "miri sysroot", Mode::ToolRustcPrivate, compiler, target);
cargo.run(builder);

// # Determine where Miri put its sysroot.
Expand Down Expand Up @@ -648,7 +649,7 @@ impl Step for Miri {
let mut cargo = tool::prepare_tool_cargo(
builder,
miri.build_compiler,
Mode::ToolRustc,
Mode::ToolRustcPrivate,
host,
Kind::Test,
"src/tools/miri",
Expand Down Expand Up @@ -861,7 +862,7 @@ impl Step for Clippy {
let mut cargo = tool::prepare_tool_cargo(
builder,
build_compiler,
Mode::ToolRustc,
Mode::ToolRustcPrivate,
target,
Kind::Test,
"src/tools/clippy",
Expand All @@ -872,7 +873,7 @@ impl Step for Clippy {
cargo.env("RUSTC_TEST_SUITE", builder.rustc(build_compiler));
cargo.env("RUSTC_LIB_PATH", builder.rustc_libdir(build_compiler));
let host_libs =
builder.stage_out(build_compiler, Mode::ToolRustc).join(builder.cargo_dir());
builder.stage_out(build_compiler, Mode::ToolRustcPrivate).join(builder.cargo_dir());
cargo.env("HOST_LIBS", host_libs);

// Build the standard library that the tests can use.
Expand Down Expand Up @@ -2411,7 +2412,7 @@ impl BookTest {
let libs = if !self.dependencies.is_empty() {
let mut lib_paths = vec![];
for dep in self.dependencies {
let mode = Mode::ToolRustc;
let mode = Mode::ToolRustcPrivate;
let target = builder.config.host_target;
let cargo = tool::prepare_tool_cargo(
builder,
Expand Down Expand Up @@ -2996,7 +2997,7 @@ impl Step for CrateRustdoc {
let mut cargo = tool::prepare_tool_cargo(
builder,
compiler,
Mode::ToolRustc,
Mode::ToolRustcPrivate,
target,
builder.kind,
"src/tools/rustdoc",
Expand Down
18 changes: 9 additions & 9 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl Step for ToolBuild {
let path = self.path;

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

// Rustc tools (miri, clippy, cargo, rustfmt, rust-analyzer)
// could use the additional optimizations.
if self.mode == Mode::ToolRustc && is_lto_stage(&self.build_compiler) {
if self.mode == Mode::ToolRustcPrivate && is_lto_stage(&self.build_compiler) {
let lto = match builder.config.rust_lto {
RustcLto::Off => Some("off"),
RustcLto::Thin => Some("thin"),
Expand Down Expand Up @@ -607,7 +607,7 @@ impl Step for ErrorIndex {
build_compiler: self.compilers.build_compiler,
target: self.compilers.target(),
tool: "error_index_generator",
mode: Mode::ToolRustc,
mode: Mode::ToolRustcPrivate,
path: "src/tools/error_index_generator",
source_type: SourceType::InTree,
extra_features: Vec::new(),
Expand Down Expand Up @@ -671,7 +671,7 @@ impl Step for RemoteTestServer {
/// Represents `Rustdoc` that either comes from the external stage0 sysroot or that is built
/// locally.
/// Rustdoc is special, because it both essentially corresponds to a `Compiler` (that can be
/// externally provided), but also to a `ToolRustc` tool.
/// externally provided), but also to a `ToolRustcPrivate` tool.
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct Rustdoc {
/// If the stage of `target_compiler` is `0`, then rustdoc is externally provided.
Expand Down Expand Up @@ -759,7 +759,7 @@ impl Step for Rustdoc {
// the wrong rustdoc being executed. To avoid the conflicting rustdocs, we name the "tool"
// rustdoc a different name.
tool: "rustdoc_tool_binary",
mode: Mode::ToolRustc,
mode: Mode::ToolRustcPrivate,
path: "src/tools/rustdoc",
source_type: SourceType::InTree,
extra_features,
Expand Down Expand Up @@ -1048,7 +1048,7 @@ impl Step for RustAnalyzer {
build_compiler,
target,
tool: "rust-analyzer",
mode: Mode::ToolRustc,
mode: Mode::ToolRustcPrivate,
path: "src/tools/rust-analyzer",
extra_features: vec!["in-rust-tree".to_owned()],
source_type: SourceType::InTree,
Expand Down Expand Up @@ -1105,7 +1105,7 @@ impl Step for RustAnalyzerProcMacroSrv {
build_compiler: self.compilers.build_compiler,
target: self.compilers.target(),
tool: "rust-analyzer-proc-macro-srv",
mode: Mode::ToolRustc,
mode: Mode::ToolRustcPrivate,
path: "src/tools/rust-analyzer/crates/proc-macro-srv-cli",
extra_features: vec!["in-rust-tree".to_owned()],
source_type: SourceType::InTree,
Expand Down Expand Up @@ -1352,7 +1352,7 @@ impl RustcPrivateCompilers {
}
}

/// Creates a step that builds an extended `Mode::ToolRustc` tool
/// Creates a step that builds an extended `Mode::ToolRustcPrivate` tool
/// and installs it into the sysroot of a corresponding compiler.
macro_rules! tool_rustc_extended {
(
Expand Down Expand Up @@ -1466,7 +1466,7 @@ fn build_extended_rustc_tool(
build_compiler,
target,
tool: tool_name,
mode: Mode::ToolRustc,
mode: Mode::ToolRustcPrivate,
path,
extra_features,
source_type: SourceType::InTree,
Expand Down
23 changes: 12 additions & 11 deletions src/bootstrap/src/core/builder/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ impl Builder<'_> {
if cmd_kind == Kind::Doc {
let my_out = match mode {
// This is the intended out directory for compiler documentation.
Mode::Rustc | Mode::ToolRustc | Mode::ToolBootstrap => {
Mode::Rustc | Mode::ToolRustcPrivate | Mode::ToolBootstrap => {
self.compiler_doc_out(target)
}
Mode::Std => {
Expand Down Expand Up @@ -583,7 +583,7 @@ impl Builder<'_> {

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

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

Expand Down Expand Up @@ -717,7 +718,7 @@ impl Builder<'_> {

match mode {
Mode::Std | Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolTarget => {}
Mode::Rustc | Mode::Codegen | Mode::ToolRustc => {
Mode::Rustc | Mode::Codegen | Mode::ToolRustcPrivate => {
// Build proc macros both for the host and the target unless proc-macros are not
// supported by the target.
if target != compiler.host && cmd_kind != Kind::Check {
Expand Down Expand Up @@ -778,7 +779,7 @@ impl Builder<'_> {
"binary-dep-depinfo,proc_macro_span,proc_macro_span_shrink,proc_macro_diagnostic"
.to_string()
}
Mode::Std | Mode::Rustc | Mode::Codegen | Mode::ToolRustc => String::new(),
Mode::Std | Mode::Rustc | Mode::Codegen | Mode::ToolRustcPrivate => String::new(),
};

cargo.arg("-j").arg(self.jobs().to_string());
Expand Down Expand Up @@ -825,7 +826,7 @@ impl Builder<'_> {
// rustc step and one that we just built. This isn't always a
// problem, somehow -- not really clear why -- but we know that this
// fixes things.
Mode::ToolRustc => metadata.push_str("tool-rustc"),
Mode::ToolRustcPrivate => metadata.push_str("tool-rustc"),
// Same for codegen backends.
Mode::Codegen => metadata.push_str("codegen"),
_ => {}
Expand Down Expand Up @@ -917,7 +918,7 @@ impl Builder<'_> {
let debuginfo_level = match mode {
Mode::Rustc | Mode::Codegen => self.config.rust_debuginfo_level_rustc,
Mode::Std => self.config.rust_debuginfo_level_std,
Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolRustc | Mode::ToolTarget => {
Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolRustcPrivate | Mode::ToolTarget => {
self.config.rust_debuginfo_level_tools
}
};
Expand All @@ -930,7 +931,7 @@ impl Builder<'_> {
match mode {
Mode::Std => self.config.std_debug_assertions,
Mode::Rustc | Mode::Codegen => self.config.rustc_debug_assertions,
Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolRustc | Mode::ToolTarget => {
Mode::ToolBootstrap | Mode::ToolStd | Mode::ToolRustcPrivate | Mode::ToolTarget => {
self.config.tools_debug_assertions
}
}
Expand Down Expand Up @@ -1005,7 +1006,7 @@ impl Builder<'_> {
}
Mode::Std
| Mode::ToolBootstrap
| Mode::ToolRustc
| Mode::ToolRustcPrivate
| Mode::ToolStd
| Mode::ToolTarget => {
if let Some(ref map_to) =
Expand Down Expand Up @@ -1078,7 +1079,7 @@ impl Builder<'_> {
// requirement, but the `-L` library path is not propagated across
// separate Cargo projects. We can add LLVM's library path to the
// rustc args as a workaround.
if (mode == Mode::ToolRustc || mode == Mode::Codegen)
if (mode == Mode::ToolRustcPrivate || mode == Mode::Codegen)
&& let Some(llvm_config) = self.llvm_config(target)
{
let llvm_libdir =
Expand Down
Loading
Loading