blob: 04516182e1b48cddd0575bec8a3c5b1d2ebc84b1 [file] [log] [blame] [view]
r[type.never]
# Never type
r[type.never.syntax]
```grammar,types
NeverType -> `!`
```
r[type.never.intro]
The never type `!` is a type with no values, representing the result of
computations that never complete.
r[type.never.coercion]
Expressions of type `!` can be coerced into any other type.
r[type.never.constraint]
The `!` type can **only** appear in function return types presently,
indicating it is a diverging function that never returns.
```rust
fn foo() -> ! {
panic!("This call never returns.");
}
```
```rust
unsafe extern "C" {
pub safe fn no_return_extern_func() -> !;
}
```