Skip to content

Commit 3f14e9c

Browse files
committed
use NO_DEBUG_ASSERTIONS properly and tweak formatting
1 parent 67389d7 commit 3f14e9c

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/tools/run-make-support/src/env.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,10 @@ pub fn env_var_os(name: &str) -> OsString {
1717
None => panic!("failed to retrieve environment variable {name:?}"),
1818
}
1919
}
20+
21+
/// Check if `NO_DEBUG_ASSERTIONS` is set (usually this may be set in CI jobs).
22+
#[track_caller]
23+
#[must_use]
24+
pub fn no_debug_assertions() -> bool {
25+
std::env::var_os("NO_DEBUG_ASSERTIONS").is_some()
26+
}

src/tools/run-make-support/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub mod scoped_run;
2222
pub mod string;
2323
pub mod targets;
2424
pub mod symbols;
25+
2526
// Internally we call our fs-related support module as `fs`, but re-export its content as `rfs`
2627
// to tests to avoid colliding with commonly used `use std::fs;`.
2728
mod fs;

tests/run-make/fmt-write-bloat/rmake.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
//@ ignore-windows
22
//@ ignore-cross-compile
33

4-
use run_make_support::{rustc, symbols::any_symbol_contains};
4+
use run_make_support::{rustc, symbols::any_symbol_contains, env::no_debug_assertions};
55

66
fn main() {
77
rustc().input("main.rs").run();
88
// panic machinery identifiers, these should not appear in the final binary
99
let mut panic_syms = vec!["panic_bounds_check", "Debug"];
10-
if !cfg!(debug_assertions) {
10+
if no_debug_assertions() {
1111
// if debug assertions are allowed, we need to allow these,
1212
// otherwise, add them to the list of symbols to deny.
1313
panic_syms.extend_from_slice(&["panicking", "panic_fmt", "pad_integral", "Display"]);

0 commit comments

Comments
 (0)