nobug 0.7.0

Assertions and active code annotations
Documentation
#![doc = include_str!("../README.md")]

pub use cfg_if::cfg_if as CFG_IF;

// printing and formatting messages
mod message;

// assertions
mod assert;

// annotations
mod annotate;

// the tool macros
mod tool;

#[cfg(debug_assertions)]
use std::sync::atomic::{AtomicBool, Ordering};

#[cfg(debug_assertions)]
#[doc(hidden)]
/// Integration tests call crate functions which are compiled without cfg(test) set.
/// But DIE! in debug builds should panic, thus we set a flag to distinguish between
/// tests and normal runs. Release builds will still be aborting.
static TESTING: AtomicBool = AtomicBool::new(false);

#[doc(hidden)]
pub fn set_testing() {
    #[cfg(debug_assertions)]
    TESTING.store(true, Ordering::Release);
}

#[doc(hidden)]
#[mutants::skip]
#[inline]
pub fn get_testing() -> bool {
    CFG_IF! {
         if #[cfg(debug_assertions)] {
             TESTING.load(Ordering::Acquire)
         } else {
             false
         }
    }
}