Rust has a `debug_assert!()` macro, which is designed to be toggled on the command line. It is on by default in debug builds, and off by default in release builds, in cargo. This matches what meson's b_ndebug option does in `if-release` mode.pull/11716/head
parent
f80f40fa4f
commit
c62989ce80
4 changed files with 24 additions and 2 deletions
@ -0,0 +1,6 @@ |
||||
## Rust now supports the b_ndebug option |
||||
|
||||
Which controls the `debug_assertions` cfg, which in turn controls |
||||
`debug_assert!()` macro. This macro is roughly equivalent to C's `assert()`, as |
||||
it can be toggled with command line options, unlike Rust's `assert!()`, which |
||||
cannot be turned off, and is not designed to be. |
@ -1,4 +1,5 @@ |
||||
fn main() { |
||||
let foo = "rust compiler is working"; |
||||
debug_assert!(false, "debug_asserts on!"); |
||||
println!("{}", foo); |
||||
} |
||||
|
Loading…
Reference in new issue