aboutsummaryrefslogtreecommitdiff
path: root/std/debug.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-08-25 10:11:58 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-08-25 10:20:06 -0400
commit629aa10c5672926eb5f8494296f5d5492cc2833f (patch)
tree59db310d0a3317ff76f24d44598146fb794c73c4 /std/debug.zig
parent5dddb45ec71ae93750fddda932ef8b7d2ffa293d (diff)
downloadzig-629aa10c5672926eb5f8494296f5d5492cc2833f.tar.gz
zig-629aa10c5672926eb5f8494296f5d5492cc2833f.zip
unreachable still codegens to unreachable in ReleaseFast test mode
closes #430
Diffstat (limited to 'std/debug.zig')
-rw-r--r--std/debug.zig10
1 files changed, 9 insertions, 1 deletions
diff --git a/std/debug.zig b/std/debug.zig
index 7652807ca3..f147e91324 100644
--- a/std/debug.zig
+++ b/std/debug.zig
@@ -12,7 +12,15 @@ error InvalidDebugInfo;
error UnsupportedDebugInfo;
pub fn assert(ok: bool) {
- if (!ok) unreachable // assertion failure
+ if (!ok) {
+ // In ReleaseFast test mode, we still want assert(false) to crash, so
+ // we insert an explicit call to @panic instead of unreachable.
+ if (builtin.is_test) {
+ @panic("assertion failure")
+ } else {
+ unreachable // assertion failure
+ }
+ }
}
var panicking = false;