Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
54a4701
tests: Test line number in debuginfo for diverging function calls
Enselic Jul 16, 2025
66d2d16
Create two methods to fix `find_oldest_ancestor_in_same_ctxt`
xizheyin Jul 21, 2025
c89fe80
Rename extended rustc tool macros
Kobzol Jun 18, 2025
d1683e7
Add metadata to `Cargo` and `RustAnalyzer` tools
Kobzol Jul 22, 2025
ca66698
Cleanup `ensure_if_default` to not require `Option` output
Kobzol Jul 22, 2025
1783af7
Add step metadata to `RustAnalyzerProcMacroSrv`
Kobzol Jul 22, 2025
533a78d
Rename `Builder::rustdoc` to `Builder::rustdoc_for_compiler`
Kobzol Jul 22, 2025
7a5f9cb
Implement `RustcPrivateCompilers` to unify building of `rustc_private…
Kobzol Jul 22, 2025
d5ac269
Add step metadata and a few tests for `Doc` steps
Kobzol Jul 22, 2025
6fecbb9
Refactor `Rustdoc`
Kobzol Jul 22, 2025
006a9bd
Fix `ToolRustc` build with `download-rustc`
Kobzol Jul 22, 2025
acb2379
Add step metadata and a simple test for codegen backends
Kobzol Jul 22, 2025
efbaa77
Port codegen backends to `RustcPrivateCompilers`
Kobzol Jul 22, 2025
3f53fba
Rename `link_compiler` to `target_compiler`
Kobzol Jul 22, 2025
7bf4a1a
Appease Clippy
Kobzol Jul 22, 2025
0b88bea
Move `dist-apple-various` from x86_64 to aarch64
shepmaster Jul 23, 2025
e497abc
Add stabilization template and revise docs
Jan 23, 2025
857f46e
Address review feedback
nikomatsakis Jan 23, 2025
7547b15
Address review feedback
jieyouxu Jun 19, 2025
64604ad
Revise content on lang feature processes
traviscross Jul 23, 2025
9c99623
Merge PR: Stabilization template, docs
traviscross Jul 25, 2025
d12ecde
constify with_exposed_provenance
RalfJung Jul 27, 2025
72927f6
Ensure correct aligement of rustc_hir::Lifetime on platforms with low…
FractalFir Jul 27, 2025
8d82365
Prepare for merging from rust-lang/rust
invalid-email-address Jul 28, 2025
645b85e
Merge ref '2b5e239c6b86' from rust-lang/rust
invalid-email-address Jul 28, 2025
466198c
Merge pull request #2519 from rust-lang/rustc-pull
tshepang Jul 28, 2025
66445e7
fix pauses
tshepang Jul 28, 2025
b707493
reword to avoid using a term used in a confusing manner, "error annot…
tshepang Jul 28, 2025
bfca77b
Merge pull request #2520 from rust-lang/tshepang/error-pattern
tshepang Jul 28, 2025
f29f073
add support for ./x check src/tools/linkchecker
pietroalbini Jul 13, 2025
c745614
bump linkchecker to edition 2024
pietroalbini Jul 13, 2025
984926e
add an argument parser to linkchecker
pietroalbini Jul 1, 2025
2b11851
Raw Pointers are Constant PatKinds too
BoxyUwU Jul 28, 2025
6693b39
add --link-targets-dir flag to linkchecker
pietroalbini Jul 1, 2025
c340233
fixed typo chunks->as_chunks
xonx4l Jul 28, 2025
68f08c5
Add `core::mem::DropGuard`
yoshuawuyts Jul 21, 2025
71920e2
fix `Atomic*::as_ptr` wording
usamoi Jul 28, 2025
3fd51ff
Rollup merge of #143883 - pietroalbini:pa-linkchecker-extra-target, r…
Zalathar Jul 29, 2025
be00c80
Rollup merge of #144034 - Enselic:diverging-function-call-debuginfo, …
Zalathar Jul 29, 2025
a8b4d6f
Rollup merge of #144236 - yoshuawuyts:drop-guard, r=Mark-Simulacrum
Zalathar Jul 29, 2025
cb1c60d
Rollup merge of #144268 - xizheyin:find-oldest-ancestor, r=jieyouxu
Zalathar Jul 29, 2025
ebe2728
Rollup merge of #144303 - Kobzol:bootstrap-tool-cleanup, r=jieyouxu
Zalathar Jul 29, 2025
e66e165
Rollup merge of #144367 - shepmaster:reduce-x86-macos-runner-usage, r…
Zalathar Jul 29, 2025
1cf467b
Rollup merge of #144539 - RalfJung:const_with_exposed_provenance, r=o…
Zalathar Jul 29, 2025
85bfbf9
Rollup merge of #144569 - tshepang:rdg-sync, r=Kobzol
Zalathar Jul 29, 2025
89a8c20
Rollup merge of #144573 - BoxyUwU:patkind_constant_ptr_docs, r=lcnr
Zalathar Jul 29, 2025
564de7e
Rollup merge of #144575 - xonx4l:patch-6, r=scottmcm
Zalathar Jul 29, 2025
f7e8322
Rollup merge of #144578 - FractalFir:m68k_fix, r=compiler-errors
Zalathar Jul 29, 2025
dcb6be3
Rollup merge of #144582 - usamoi:docs, r=RalfJung
Zalathar Jul 29, 2025
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
Prev Previous commit
Next Next commit
Port codegen backends to RustcPrivateCompilers
  • Loading branch information
Kobzol committed Jul 23, 2025
commit efbaa77c41226f82df9563f6dd28b8224c4b2b75
63 changes: 33 additions & 30 deletions src/bootstrap/src/core/build_steps/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use serde_derive::Deserialize;
use tracing::{instrument, span};

use crate::core::build_steps::gcc::{Gcc, add_cg_gcc_cargo_flags};
use crate::core::build_steps::tool::{SourceType, copy_lld_artifacts};
use crate::core::build_steps::tool::{RustcPrivateCompilers, SourceType, copy_lld_artifacts};
use crate::core::build_steps::{dist, llvm};
use crate::core::builder;
use crate::core::builder::{
Expand Down Expand Up @@ -1133,7 +1133,7 @@ impl Step for Rustc {
cargo.env("RUSTC_BOLT_LINK_FLAGS", "1");
}

let _guard = builder.msg_sysroot_tool(
let _guard = builder.msg_rustc_tool(
Kind::Build,
build_compiler.stage,
format_args!("compiler artifacts{}", crate_description(&self.crates)),
Expand Down Expand Up @@ -1546,9 +1546,8 @@ impl Step for RustcLink {

#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct CodegenBackend {
pub target: TargetSelection,
pub compiler: Compiler,
pub backend: String,
compilers: RustcPrivateCompilers,
backend: String,
}

fn needs_codegen_config(run: &RunConfig<'_>) -> bool {
Expand Down Expand Up @@ -1612,8 +1611,11 @@ impl Step for CodegenBackend {
}

run.builder.ensure(CodegenBackend {
target: run.target,
compiler: run.builder.compiler(run.builder.top_stage, run.build_triple()),
compilers: RustcPrivateCompilers::new(
run.builder,
run.builder.top_stage,
run.target,
),
backend: backend.clone(),
});
}
Expand All @@ -1626,21 +1628,17 @@ impl Step for CodegenBackend {
name = "CodegenBackend::run",
skip_all,
fields(
compiler = ?self.compiler,
target = ?self.target,
backend = ?self.target,
compilers = ?self.compilers,
backend = ?self.backend,
),
),
)]
fn run(self, builder: &Builder<'_>) {
let compiler = self.compiler;
let target = self.target;
let backend = self.backend;
let target = self.compilers.target();
let build_compiler = self.compilers.build_compiler();

// FIXME: migrate to RustcPrivateCompilers
builder.ensure(Rustc::new(compiler, target));

if builder.config.keep_stage.contains(&compiler.stage) {
if builder.config.keep_stage.contains(&build_compiler.stage) {
trace!("`keep-stage` requested");
builder.info(
"WARNING: Using a potentially old codegen backend. \
Expand All @@ -1651,17 +1649,11 @@ impl Step for CodegenBackend {
return;
}

let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target);
if compiler_to_use != compiler {
builder.ensure(CodegenBackend { compiler: compiler_to_use, target, backend });
return;
}

let out_dir = builder.cargo_out(compiler, Mode::Codegen, target);
let out_dir = builder.cargo_out(build_compiler, Mode::Codegen, target);

let mut cargo = builder::Cargo::new(
builder,
compiler,
build_compiler,
Mode::Codegen,
SourceType::InTree,
target,
Expand All @@ -1682,7 +1674,13 @@ impl Step for CodegenBackend {

let tmp_stamp = BuildStamp::new(&out_dir).with_prefix("tmp");

let _guard = builder.msg_build(compiler, format_args!("codegen backend {backend}"), target);
let _guard = builder.msg_rustc_tool(
Kind::Build,
build_compiler.stage,
format_args!("codegen backend {backend}"),
build_compiler.host,
target,
);
let files = run_cargo(builder, cargo, vec![], &tmp_stamp, vec![], false, false);
if builder.config.dry_run() {
return;
Expand All @@ -1702,15 +1700,18 @@ impl Step for CodegenBackend {
f.display()
);
}
let stamp = build_stamp::codegen_backend_stamp(builder, compiler, target, &backend);
let stamp = build_stamp::codegen_backend_stamp(builder, build_compiler, target, &backend);
let codegen_backend = codegen_backend.to_str().unwrap();
t!(stamp.add_stamp(codegen_backend).write());
}

fn metadata(&self) -> Option<StepMetadata> {
Some(
StepMetadata::build(&format!("rustc_codegen_{}", self.backend), self.target)
.built_by(self.compiler),
StepMetadata::build(
&format!("rustc_codegen_{}", self.backend),
self.compilers.target(),
)
.built_by(self.compilers.build_compiler()),
)
}
}
Expand Down Expand Up @@ -2199,8 +2200,10 @@ impl Step for Assemble {
continue;
}
builder.ensure(CodegenBackend {
compiler: build_compiler,
target: target_compiler.host,
compilers: RustcPrivateCompilers::from_build_and_link_compiler(
build_compiler,
target_compiler,
),
backend: backend.clone(),
});
}
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 @@ -811,7 +811,7 @@ impl Step for Rustc {
let compiler = builder.compiler(stage, builder.config.host_target);
builder.std(compiler, builder.config.host_target);

let _guard = builder.msg_sysroot_tool(
let _guard = builder.msg_rustc_tool(
Kind::Doc,
stage,
format!("compiler{}", crate_description(&self.crates)),
Expand Down
13 changes: 6 additions & 7 deletions src/bootstrap/src/core/build_steps/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ impl Step for Miri {
cargo.env("MIRI_TEST_TARGET", target.rustc_target_arg());

{
let _guard = builder.msg_sysroot_tool(Kind::Test, stage, "miri", host, target);
let _guard = builder.msg_rustc_tool(Kind::Test, stage, "miri", host, target);
let _time = helpers::timeit(builder);
cargo.run(builder);
}
Expand All @@ -616,7 +616,7 @@ impl Step for Miri {
cargo.args(["tests/pass", "tests/panic"]);

{
let _guard = builder.msg_sysroot_tool(
let _guard = builder.msg_rustc_tool(
Kind::Test,
stage,
"miri (mir-opt-level 4)",
Expand Down Expand Up @@ -693,7 +693,7 @@ impl Step for CargoMiri {
// Finally, run everything.
let mut cargo = BootstrapCommand::from(cargo);
{
let _guard = builder.msg_sysroot_tool(Kind::Test, stage, "cargo-miri", host, target);
let _guard = builder.msg_rustc_tool(Kind::Test, stage, "cargo-miri", host, target);
let _time = helpers::timeit(builder);
cargo.run(builder);
}
Expand Down Expand Up @@ -820,8 +820,7 @@ impl Step for Clippy {
cargo.add_rustc_lib_path(builder);
let cargo = prepare_cargo_test(cargo, &[], &[], host, builder);

let _guard =
builder.msg_sysroot_tool(Kind::Test, build_compiler.stage, "clippy", host, host);
let _guard = builder.msg_rustc_tool(Kind::Test, build_compiler.stage, "clippy", host, host);

// Clippy reports errors if it blessed the outputs
if cargo.allow_failure().run(builder) {
Expand Down Expand Up @@ -1088,7 +1087,7 @@ impl Step for RustdocGUI {
}

let _time = helpers::timeit(builder);
let _guard = builder.msg_sysroot_tool(
let _guard = builder.msg_rustc_tool(
Kind::Test,
self.compiler.stage,
"rustdoc-gui",
Expand Down Expand Up @@ -2573,7 +2572,7 @@ fn run_cargo_test<'a>(
let mut cargo = prepare_cargo_test(cargo, libtest_args, crates, target, builder);
let _time = helpers::timeit(builder);
let _group = description.into().and_then(|what| {
builder.msg_sysroot_tool(Kind::Test, compiler.stage, what, compiler.host, target)
builder.msg_rustc_tool(Kind::Test, compiler.stage, what, compiler.host, target)
});

#[cfg(feature = "build-metrics")]
Expand Down
14 changes: 7 additions & 7 deletions src/bootstrap/src/core/build_steps/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,9 @@ impl Builder<'_> {
) -> Option<gha::Group> {
match mode {
// depends on compiler stage, different to host compiler
Mode::ToolRustc => self.msg_sysroot_tool(
kind,
build_stage,
format_args!("tool {tool}"),
*host,
*target,
),
Mode::ToolRustc => {
self.msg_rustc_tool(kind, build_stage, format_args!("tool {tool}"), *host, *target)
}
// doesn't depend on compiler, same as host compiler
_ => self.msg(kind, build_stage, format_args!("tool {tool}"), *host, *target),
}
Expand Down Expand Up @@ -1327,6 +1323,10 @@ impl RustcPrivateCompilers {
Self { build_compiler, link_compiler }
}

pub fn from_build_and_link_compiler(build_compiler: Compiler, link_compiler: Compiler) -> Self {
Self { build_compiler, link_compiler }
}

/// Create rustc tool compilers from the build compiler.
pub fn from_build_compiler(
builder: &Builder<'_>,
Expand Down
3 changes: 0 additions & 3 deletions src/bootstrap/src/core/builder/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,9 +731,6 @@ mod snapshot {
[build] rustc 0 <host> -> rustc 1 <host>
[build] rustc 0 <host> -> rustc_codegen_cranelift 1 <host>
[build] rustc 1 <host> -> std 1 <host>
[build] rustc 1 <host> -> std 1 <host>
[build] rustc 1 <host> -> rustc 2 <host>
[build] rustc 1 <host> -> rustc_codegen_cranelift 2 <host>
[build] rustdoc 1 <host>
"
);
Expand Down
13 changes: 1 addition & 12 deletions src/bootstrap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1060,17 +1060,6 @@ impl Build {
self.msg(Kind::Doc, compiler.stage, what, compiler.host, target.into())
}

#[must_use = "Groups should not be dropped until the Step finishes running"]
#[track_caller]
fn msg_build(
&self,
compiler: Compiler,
what: impl Display,
target: impl Into<Option<TargetSelection>>,
) -> Option<gha::Group> {
self.msg(Kind::Build, compiler.stage, what, compiler.host, target)
}

/// Return a `Group` guard for a [`Step`] that is built for each `--stage`.
///
/// [`Step`]: crate::core::builder::Step
Expand Down Expand Up @@ -1117,7 +1106,7 @@ impl Build {

#[must_use = "Groups should not be dropped until the Step finishes running"]
#[track_caller]
fn msg_sysroot_tool(
fn msg_rustc_tool(
&self,
action: impl Into<Kind>,
build_stage: u32,
Expand Down