Never

The type, also called uninhabited type, indicated with an exclamation point  is a primitive type that has no values. The never type can never exist at runtime, because it cannot be constructed. It is the return type of divergent functions, which never return:

Using  in other places than the return type of a function, is experimental and requires the   nightly feature. A workaround is to use an enum with no variants:

The standard library contains a similar type,, which is used as the error type for conversions that never fail. For example:

When the  feature is stabilized, it will be possible to replace Infallible with   everywhere. Note that this is a zero-cost abstraction thanks to Rusts layout optimizations.

is a bottom type, which means that it is a subtype of every other type, and can be coerced to any type. This is exploited when using or another panicking macro, which evaluates to  :

has no impact on type inference. When no type is explicitly specified, Rust infers the unit type, which becomes apparent in some error messages:

implements many traits from the standard library, to make it easier to use it in generic contexts.