]>
Commit | Line | Data |
---|---|---|
13cf67c4 XL |
1 | # Never type |
2 | ||
3 | > **<sup>Syntax</sup>**\ | |
4 | > _NeverType_ : `!` | |
5 | ||
6 | The never type `!` is a type with no values, representing the result of | |
7 | computations that never complete. Expressions of type `!` can be coerced into | |
8 | any other type. | |
60c5eb7d XL |
9 | |
10 | ```rust,should_panic | |
11 | #![feature(never_type)] | |
12 | let x: ! = panic!(); | |
13 | // Can be coerced into any type. | |
14 | let y: u32 = x; | |
15 | ``` | |
16 | ||
17 | **NB.** The never type was expected to be stabilized in 1.41, but due | |
18 | to some last minute regressions detected the stabilization was | |
19 | temporarily reverted. The `!` type can only appear in function return | |
20 | types presently. See [the tracking | |
21 | issue](https://github.com/rust-lang/rust/issues/35121) for more | |
22 | details. |