Statically assert that a program written in Rust does not panic
This crate is used to statically assert that no panics whatsoever are present in the final program.
If any panics are present and are not optimized out, compiling will produce the following error:
sh
error: the static assertion that no panics are present has failed
Note: this crate will only work when compiling with no_std
.
```rust
extern crate libc; extern crate nopanicswhatsoever;
extern "C" fn eh_personality() {}
fn foo(a: &[i32]) -> i32 { // a.get(0).copied().unwrap_or(1) // Compiles fine! a[0] // Fails to compile! }
main
in the outputpub extern fn main(argc: i32, _argv: *const *const u8) -> i32 { foo(core::hint::blackbox(&[42])) } ```