about summary refs log tree commit diff
path: root/src/test/run-fail
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2015-03-06 08:58:30 +0530
committerManish Goregaokar <manishsmail@gmail.com>2015-03-06 08:58:30 +0530
commitefb487b503d87f04448fc5e6f75038ca98b8670e (patch)
tree61baab48b0fb84ec3f95e617db7dbff2f4dcfc01 /src/test/run-fail
parent9eb596ce8f4b70ba73e8671f9b42147c91319842 (diff)
parentd5d834551cd5a7e7d89ac9f2ae642a93409ed989 (diff)
downloadrust-efb487b503d87f04448fc5e6f75038ca98b8670e.tar.gz
rust-efb487b503d87f04448fc5e6f75038ca98b8670e.zip
Rollup merge of #22980 - alexcrichton:debug-assertions, r=pnkfelix
 This commit is an implementation of [RFC 563][rfc] which adds a new
`cfg(debug_assertions)` directive which is specially recognized and calculated
by the compiler. The flag is turned off at any optimization level greater than 1
and may also be explicitly controlled through the `-C debug-assertions`
flag.

[rfc]: https://github.com/rust-lang/rfcs/pull/563

The `debug_assert!` and `debug_assert_eq!` macros now respect this instead of
the `ndebug` variable and `ndebug` no longer holds any meaning to the standard
library.

Code which was previously relying on `not(ndebug)` to gate expensive code should
be updated to rely on `debug_assertions` instead.

Closes #22492
[breaking-change]
Diffstat (limited to 'src/test/run-fail')
-rw-r--r--src/test/run-fail/overflowing-add.rs1
-rw-r--r--src/test/run-fail/overflowing-mul.rs1
-rw-r--r--src/test/run-fail/overflowing-sub.rs1
3 files changed, 3 insertions, 0 deletions
diff --git a/src/test/run-fail/overflowing-add.rs b/src/test/run-fail/overflowing-add.rs
index 34a03e5f008..cd13b817c2b 100644
--- a/src/test/run-fail/overflowing-add.rs
+++ b/src/test/run-fail/overflowing-add.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // error-pattern:thread '<main>' panicked at 'arithmetic operation overflowed'
+// compile-flags: -C debug-assertions
 
 // (Work around constant-evaluation)
 fn value() -> u8 { 200 }
diff --git a/src/test/run-fail/overflowing-mul.rs b/src/test/run-fail/overflowing-mul.rs
index b18d99cd232..5d2f5396240 100644
--- a/src/test/run-fail/overflowing-mul.rs
+++ b/src/test/run-fail/overflowing-mul.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // error-pattern:thread '<main>' panicked at 'arithmetic operation overflowed'
+// compile-flags: -C debug-assertions
 
 // (Work around constant-evaluation)
 fn value() -> u8 { 200 }
diff --git a/src/test/run-fail/overflowing-sub.rs b/src/test/run-fail/overflowing-sub.rs
index ee32291eca6..b089dccbaa5 100644
--- a/src/test/run-fail/overflowing-sub.rs
+++ b/src/test/run-fail/overflowing-sub.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // error-pattern:thread '<main>' panicked at 'arithmetic operation overflowed'
+// compile-flags: -C debug-assertions
 
 // (Work around constant-evaluation)
 fn value() -> u8 { 42 }