inconceivable 0.9.0

`inconceivable!` is a macro which closely parallels `std::unreachable`, or `std::panic`. The primary difference is that when this crate is configured with the `ub_inconceivable` option it will emit the `core::hint::unreachable_unchecked` to hint for the compiler to understand a condition should never occur. Generally compiler(s) (the LLVM) assume UB won't happen. This macro offers the "best of both worlds", it provides a solid way of asserting/testing behavior in local builds, but also a way of stripping branches out of final release builds. Please Note: This crate is created purely to inject undefined behavior into stable, safe rust. Systematic usage is unwise, and not recommended.
Documentation

feature_macros

This crate allows for controling how safe/unsafe other crates are.

Example

This macro can (but should not necessarily) be used identically to unreachable! or panic!.


    match x {
        Foo::Bar => bar(&x),
        Foo::Baz => baz(&x),
        _ => inconceivable!(),
    } 

Developer Controllable Options

  • ub_inconceivable: This controls the semantics of the inconceivable! macro. When this options is not supplied (or when this options is supplied, and the crate is compiled with rustc --version < 1.27) inconceivable! will simply alias unreachable!. When this option is supplied (and the crate is compiled with rustc --version >= 1.27) this will instead emit unreachable_uncheck() which is UB.

Developer Uncontrollable Options

  • RUSTC_VERSION_GE_1_27: States if rustc --version >= 1.27 this is used as a feature check.