::never-say-never
The ! type. In stable Rust. Since 1.14.0.
Better than an enum Never {} definition would be, since an instance of
type ! automagically coerces to any type, whereas an instance of
enum EmptyEnum {} needs an explicit match it {}.
- Currently,
::core::convert::Infallibleis a sad instance of the latter.
That is, the following fails to compile:
let x: u32 = match <u32 as >try_from ;
but the following doesn't!
use Never;
let x: u32 = match Ok:: ;