Skip to content

Commit 69b79a3

Browse files
committed
add check and feature flag for serde derive
1 parent fc85328 commit 69b79a3

File tree

6 files changed

+12
-4
lines changed

6 files changed

+12
-4
lines changed

Cargo.lock

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ name = "anyhow"
186186
version = "1.0.95"
187187
source = "registry+https://github.com/rust-lang/crates.io-index"
188188
checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
189+
dependencies = [
190+
"backtrace",
191+
]
189192

190193
[[package]]
191194
name = "ar_archive_writer"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,7 @@ tool_check_step!(Rls { path: "src/tools/rls" });
455455
tool_check_step!(Rustfmt { path: "src/tools/rustfmt" });
456456
tool_check_step!(MiroptTestTools { path: "src/tools/miropt-test-tools" });
457457
tool_check_step!(TestFloatParse { path: "src/etc/test-float-parse" });
458+
tool_check_step!(FeaturesStatusDump { path: "src/tools/features-status-dump" });
458459

459460
tool_check_step!(Bootstrap { path: "src/bootstrap", default: false });
460461

src/bootstrap/src/core/builder/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -938,6 +938,7 @@ impl<'a> Builder<'a> {
938938
check::Bootstrap,
939939
check::RunMakeSupport,
940940
check::Compiletest,
941+
check::FeaturesStatusDump,
941942
),
942943
Kind::Test => describe!(
943944
crate::core::build_steps::toolstate::ToolStateCheck,

src/tools/features-status-dump/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ anyhow = { version = "1", features = ["backtrace"] }
99
clap = { version = "4", features = ["derive"] }
1010
serde = { version = "1.0.125", features = [ "derive" ] }
1111
serde_json = "1.0.59"
12-
tidy = { path = "../tidy" }
12+
tidy = { path = "../tidy", features = ["build-metrics"] }

src/tools/tidy/Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,15 @@ miropt-test-tools = { path = "../miropt-test-tools" }
1212
walkdir = "2"
1313
ignore = "0.4.18"
1414
semver = "1.0"
15-
serde = { version = "1.0.125", features = [ "derive" ] }
15+
serde = { version = "1.0.125", features = [ "derive" ], optional = true }
1616
termcolor = "1.1.3"
1717
rustc-hash = "2.0.0"
1818
fluent-syntax = "0.11.1"
1919
similar = "2.5.0"
2020

21+
[features]
22+
build-metrics = ["serde"]
23+
2124
[[bin]]
2225
name = "rust-tidy"
2326
path = "src/main.rs"

src/tools/tidy/src/features.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const FEATURE_GROUP_START_PREFIX: &str = "// feature-group-start";
2727
const FEATURE_GROUP_END_PREFIX: &str = "// feature-group-end";
2828

2929
#[derive(Debug, PartialEq, Clone)]
30-
#[derive(serde::Serialize)]
30+
#[cfg_attr(feature = "build-metrics", derive(serde::Serialize))]
3131
pub enum Status {
3232
Accepted,
3333
Removed,
@@ -46,7 +46,7 @@ impl fmt::Display for Status {
4646
}
4747

4848
#[derive(Debug, Clone)]
49-
#[derive(serde::Serialize)]
49+
#[cfg_attr(feature = "build-metrics", derive(serde::Serialize))]
5050
pub struct Feature {
5151
pub level: Status,
5252
pub since: Option<Version>,

0 commit comments

Comments
 (0)