Skip to content

Commit d403934

Browse files
committed
Remove manual #[instrument] annotations on steps
They could easily get out of sync and miss some fields. Now all steps are instrumented automatically.
1 parent 690c781 commit d403934

File tree

5 files changed

+1
-161
lines changed

5 files changed

+1
-161
lines changed

src/bootstrap/src/bin/main.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ use bootstrap::{
1515
Build, CONFIG_CHANGE_HISTORY, ChangeId, Config, Flags, Subcommand, debug,
1616
find_recent_config_change_ids, human_readable_changes, symlink_dir, t,
1717
};
18-
#[cfg(feature = "tracing")]
19-
use tracing::instrument;
2018

2119
fn is_profiling_enabled() -> bool {
2220
env::var("BOOTSTRAP_PROFILE").is_ok_and(|v| v == "1")
@@ -26,7 +24,6 @@ fn is_tracing_enabled() -> bool {
2624
is_profiling_enabled() || cfg!(feature = "tracing")
2725
}
2826

29-
#[cfg_attr(feature = "tracing", instrument(level = "trace", name = "main"))]
3027
fn main() {
3128
#[cfg(feature = "tracing")]
3229
let guard = setup_tracing(is_profiling_enabled());

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

Lines changed: 1 addition & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::{env, fs, str};
1616

1717
use serde_derive::Deserialize;
1818
#[cfg(feature = "tracing")]
19-
use tracing::{instrument, span};
19+
use tracing::span;
2020

2121
use crate::core::build_steps::gcc::{Gcc, add_cg_gcc_cargo_flags};
2222
use crate::core::build_steps::tool::{RustcPrivateCompilers, SourceType, copy_lld_artifacts};
@@ -104,7 +104,6 @@ impl Step for Std {
104104
run.crate_or_deps("sysroot").path("library")
105105
}
106106

107-
#[cfg_attr(feature = "tracing", instrument(level = "trace", name = "Std::make_run", skip_all))]
108107
fn make_run(run: RunConfig<'_>) {
109108
let crates = std_crates_for_run_make(&run);
110109
let builder = run.builder;
@@ -135,19 +134,6 @@ impl Step for Std {
135134
/// This will build the standard library for a particular stage of the build
136135
/// using the `compiler` targeting the `target` architecture. The artifacts
137136
/// created will also be linked into the sysroot directory.
138-
#[cfg_attr(
139-
feature = "tracing",
140-
instrument(
141-
level = "debug",
142-
name = "Std::run",
143-
skip_all,
144-
fields(
145-
target = ?self.target,
146-
compiler = ?self.compiler,
147-
force_recompile = self.force_recompile
148-
),
149-
),
150-
)]
151137
fn run(self, builder: &Builder<'_>) {
152138
let target = self.target;
153139

@@ -711,19 +697,6 @@ impl Step for StdLink {
711697
/// Note that this assumes that `compiler` has already generated the libstd
712698
/// libraries for `target`, and this method will find them in the relevant
713699
/// output directory.
714-
#[cfg_attr(
715-
feature = "tracing",
716-
instrument(
717-
level = "trace",
718-
name = "StdLink::run",
719-
skip_all,
720-
fields(
721-
compiler = ?self.compiler,
722-
target_compiler = ?self.target_compiler,
723-
target = ?self.target
724-
),
725-
),
726-
)]
727700
fn run(self, builder: &Builder<'_>) {
728701
let compiler = self.compiler;
729702
let target_compiler = self.target_compiler;
@@ -889,15 +862,6 @@ impl Step for StartupObjects {
889862
/// They don't require any library support as they're just plain old object
890863
/// files, so we just use the nightly snapshot compiler to always build them (as
891864
/// no other compilers are guaranteed to be available).
892-
#[cfg_attr(
893-
feature = "tracing",
894-
instrument(
895-
level = "trace",
896-
name = "StartupObjects::run",
897-
skip_all,
898-
fields(compiler = ?self.compiler, target = ?self.target),
899-
),
900-
)]
901865
fn run(self, builder: &Builder<'_>) -> Vec<(PathBuf, DependencyType)> {
902866
let for_compiler = self.compiler;
903867
let target = self.target;
@@ -1027,15 +991,6 @@ impl Step for Rustc {
1027991
/// This will build the compiler for a particular stage of the build using
1028992
/// the `build_compiler` targeting the `target` architecture. The artifacts
1029993
/// created will also be linked into the sysroot directory.
1030-
#[cfg_attr(
1031-
feature = "tracing",
1032-
instrument(
1033-
level = "debug",
1034-
name = "Rustc::run",
1035-
skip_all,
1036-
fields(previous_compiler = ?self.build_compiler, target = ?self.target),
1037-
),
1038-
)]
1039994
fn run(self, builder: &Builder<'_>) -> u32 {
1040995
let build_compiler = self.build_compiler;
1041996
let target = self.target;
@@ -1511,19 +1466,6 @@ impl Step for RustcLink {
15111466
}
15121467

15131468
/// Same as `std_link`, only for librustc
1514-
#[cfg_attr(
1515-
feature = "tracing",
1516-
instrument(
1517-
level = "trace",
1518-
name = "RustcLink::run",
1519-
skip_all,
1520-
fields(
1521-
compiler = ?self.compiler,
1522-
previous_stage_compiler = ?self.previous_stage_compiler,
1523-
target = ?self.target,
1524-
),
1525-
),
1526-
)]
15271469
fn run(self, builder: &Builder<'_>) {
15281470
let compiler = self.compiler;
15291471
let previous_stage_compiler = self.previous_stage_compiler;
@@ -1556,17 +1498,6 @@ impl Step for GccCodegenBackend {
15561498
});
15571499
}
15581500

1559-
#[cfg_attr(
1560-
feature = "tracing",
1561-
instrument(
1562-
level = "debug",
1563-
name = "GccCodegenBackend::run",
1564-
skip_all,
1565-
fields(
1566-
compilers = ?self.compilers,
1567-
),
1568-
),
1569-
)]
15701501
fn run(self, builder: &Builder<'_>) -> Self::Output {
15711502
let target = self.compilers.target();
15721503
let build_compiler = self.compilers.build_compiler();
@@ -1641,17 +1572,6 @@ impl Step for CraneliftCodegenBackend {
16411572
});
16421573
}
16431574

1644-
#[cfg_attr(
1645-
feature = "tracing",
1646-
instrument(
1647-
level = "debug",
1648-
name = "CraneliftCodegenBackend::run",
1649-
skip_all,
1650-
fields(
1651-
compilers = ?self.compilers,
1652-
),
1653-
),
1654-
)]
16551575
fn run(self, builder: &Builder<'_>) -> Self::Output {
16561576
let target = self.compilers.target();
16571577
let build_compiler = self.compilers.build_compiler();
@@ -1816,15 +1736,6 @@ impl Step for Sysroot {
18161736
/// Returns the sysroot that `compiler` is supposed to use.
18171737
/// For the stage0 compiler, this is stage0-sysroot (because of the initial std build).
18181738
/// For all other stages, it's the same stage directory that the compiler lives in.
1819-
#[cfg_attr(
1820-
feature = "tracing",
1821-
instrument(
1822-
level = "debug",
1823-
name = "Sysroot::run",
1824-
skip_all,
1825-
fields(compiler = ?self.compiler),
1826-
),
1827-
)]
18281739
fn run(self, builder: &Builder<'_>) -> PathBuf {
18291740
let compiler = self.compiler;
18301741
let host_dir = builder.out.join(compiler.host);
@@ -2000,15 +1911,6 @@ impl Step for Assemble {
20001911
/// This will assemble a compiler in `build/$host/stage$stage`. The compiler
20011912
/// must have been previously produced by the `stage - 1` builder.build
20021913
/// compiler.
2003-
#[cfg_attr(
2004-
feature = "tracing",
2005-
instrument(
2006-
level = "debug",
2007-
name = "Assemble::run",
2008-
skip_all,
2009-
fields(target_compiler = ?self.target_compiler),
2010-
),
2011-
)]
20121914
fn run(self, builder: &Builder<'_>) -> Compiler {
20131915
let target_compiler = self.target_compiler;
20141916

src/bootstrap/src/core/build_steps/llvm.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ use std::sync::OnceLock;
1515
use std::{env, fs};
1616

1717
use build_helper::git::PathFreshness;
18-
#[cfg(feature = "tracing")]
19-
use tracing::instrument;
2018

2119
use crate::core::builder::{Builder, RunConfig, ShouldRun, Step, StepMetadata};
2220
use crate::core::config::{Config, TargetSelection};
@@ -266,15 +264,6 @@ impl Step for Llvm {
266264
}
267265

268266
/// Compile LLVM for `target`.
269-
#[cfg_attr(
270-
feature = "tracing",
271-
instrument(
272-
level = "debug",
273-
name = "Llvm::run",
274-
skip_all,
275-
fields(target = ?self.target),
276-
),
277-
)]
278267
fn run(self, builder: &Builder<'_>) -> LlvmResult {
279268
let target = self.target;
280269
let target_native = if self.target.starts_with("riscv") {
@@ -919,15 +908,6 @@ impl Step for Enzyme {
919908
}
920909

921910
/// Compile Enzyme for `target`.
922-
#[cfg_attr(
923-
feature = "tracing",
924-
instrument(
925-
level = "debug",
926-
name = "Enzyme::run",
927-
skip_all,
928-
fields(target = ?self.target),
929-
),
930-
)]
931911
fn run(self, builder: &Builder<'_>) -> PathBuf {
932912
builder.require_submodule(
933913
"src/tools/enzyme",

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ use std::path::{Path, PathBuf};
1010
use std::{env, fs, iter};
1111

1212
use build_helper::exit;
13-
#[cfg(feature = "tracing")]
14-
use tracing::instrument;
1513

1614
use crate::core::build_steps::compile::{Std, run_cargo};
1715
use crate::core::build_steps::doc::DocumentationFormat;
@@ -760,10 +758,6 @@ impl Step for CompiletestTest {
760758
}
761759

762760
/// Runs `cargo test` for compiletest.
763-
#[cfg_attr(
764-
feature = "tracing",
765-
instrument(level = "debug", name = "CompiletestTest::run", skip_all)
766-
)]
767761
fn run(self, builder: &Builder<'_>) {
768762
let host = self.host;
769763

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

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ use std::ffi::OsStr;
1313
use std::path::PathBuf;
1414
use std::{env, fs};
1515

16-
#[cfg(feature = "tracing")]
17-
use tracing::instrument;
18-
1916
use crate::core::build_steps::compile::is_lto_stage;
2017
use crate::core::build_steps::toolstate::ToolState;
2118
use crate::core::build_steps::{compile, llvm};
@@ -443,14 +440,6 @@ macro_rules! bootstrap_tool {
443440
});
444441
}
445442

446-
#[cfg_attr(
447-
feature = "tracing",
448-
instrument(
449-
level = "debug",
450-
name = $tool_name,
451-
skip_all,
452-
),
453-
)]
454443
fn run(self, builder: &Builder<'_>) -> ToolBuildResult {
455444
$(
456445
for submodule in $submodules {
@@ -927,15 +916,6 @@ impl Step for LldWrapper {
927916
});
928917
}
929918

930-
#[cfg_attr(
931-
feature = "tracing",
932-
instrument(
933-
level = "debug",
934-
name = "LldWrapper::run",
935-
skip_all,
936-
fields(build_compiler = ?self.build_compiler),
937-
),
938-
)]
939919
fn run(self, builder: &Builder<'_>) -> Self::Output {
940920
let lld_dir = builder.ensure(llvm::Lld { target: self.target });
941921
let tool = builder.ensure(ToolBuild {
@@ -1028,15 +1008,6 @@ impl Step for WasmComponentLd {
10281008
});
10291009
}
10301010

1031-
#[cfg_attr(
1032-
feature = "tracing",
1033-
instrument(
1034-
level = "debug",
1035-
name = "WasmComponentLd::run",
1036-
skip_all,
1037-
fields(build_compiler = ?self.build_compiler),
1038-
),
1039-
)]
10401011
fn run(self, builder: &Builder<'_>) -> ToolBuildResult {
10411012
builder.ensure(ToolBuild {
10421013
build_compiler: self.build_compiler,
@@ -1233,10 +1204,6 @@ impl Step for LlvmBitcodeLinker {
12331204
});
12341205
}
12351206

1236-
#[cfg_attr(
1237-
feature = "tracing",
1238-
instrument(level = "debug", name = "LlvmBitcodeLinker::run", skip_all)
1239-
)]
12401207
fn run(self, builder: &Builder<'_>) -> ToolBuildResult {
12411208
builder.ensure(ToolBuild {
12421209
build_compiler: self.build_compiler,

0 commit comments

Comments
 (0)