Skip to content

Commit 2560340

Browse files
authored
fix(build-rs)!: Remove meaningless 'cargo_cfg_debug_assertions' (#14901)
### What does this PR try to resolve? The documentation that was added was pulled straight from a comment in `custom_build.rs`: > This cfg is always true and misleading, so avoid setting it. > That is because Cargo queries rustc without any profile settings. It is therefore misleading to expose this in the API ### How should we test and review this PR? ### Additional information
2 parents a4a3651 + 71f68dc commit 2560340

File tree

5 files changed

+8
-4
lines changed

5 files changed

+8
-4
lines changed

Cargo.lock

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ anstyle = "1.0.8"
2424
anyhow = "1.0.86"
2525
base64 = "0.22.1"
2626
blake3 = "1.5.2"
27-
build-rs = { version = "0.2.0", path = "crates/build-rs" }
27+
build-rs = { version = "0.3.0", path = "crates/build-rs" }
2828
bytesize = "1.3"
2929
cargo = { path = "" }
3030
cargo-credential = { version = "0.4.2", path = "credential/cargo-credential" }

crates/build-rs-test-lib/build.rs

-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ fn smoke_test_inputs() {
1010
use build_rs::input::*;
1111
dbg!(cargo());
1212
dbg!(cargo_cfg("careful"));
13-
dbg!(cargo_cfg_debug_assertions());
1413
#[cfg(feature = "unstable")]
1514
dbg!(cargo_cfg_fmt_debug());
1615
#[cfg(feature = "unstable")]

crates/build-rs/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "build-rs"
3-
version = "0.2.0"
3+
version = "0.3.0"
44
rust-version.workspace = true
55
edition.workspace = true
66
license.workspace = true

crates/build-rs/src/input.rs

+5
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ mod cfg {
109109
}
110110

111111
/// If we are compiling with debug assertions enabled.
112+
///
113+
/// Build scripts are not passed this cfg because
114+
/// this cfg is always true and misleading.
115+
/// That is because Cargo queries rustc without any profile settings.
116+
#[cfg(any())]
112117
#[track_caller]
113118
pub fn cargo_cfg_debug_assertions() -> bool {
114119
is_present("CARGO_CFG_DEBUG_ASSERTIONS")

0 commit comments

Comments
 (0)