Debug Unsafe (Rust)
Uses debug-assertions compiler flag as a switch of safe/unsafe behaviour.
It's mainly used for tests to trigger panic instead of UB in unsafe calls.
If you want an extra safe (but less performant) behaviour, or need to catch an UB, you can enable debug-assertions (safe behaviour):
-
only for this library in Cargo.toml with:
[] = true -
globally in a command line with:
RUSTFLAGS="-C debug-assertions" cargo build --release(requirescargo cleanfirst, if it was previously built without the flag).