File tree 1 file changed +13
-12
lines changed
1 file changed +13
-12
lines changed Original file line number Diff line number Diff line change 5
5
6
6
The never type ` ! ` is a type with no values, representing the result of
7
7
computations that never complete. Expressions of type ` ! ` can be coerced into
8
- any other type.
8
+ any other type.
9
9
10
- <!-- ignore: unstable -->
11
- ``` rust,ignore
12
- let x: ! = panic!();
13
- // Can be coerced into any type.
14
- let y: u32 = x;
10
+ The ` ! ` type can ** only** appear in function return types presently,
11
+ indicating it is a diverging function that never returns.
12
+
13
+ ``` rust
14
+ fn foo () -> ! {
15
+ panic! (" This call never returns." );
16
+ }
15
17
```
16
18
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.
19
+ ``` rust
20
+ extern " C" {
21
+ pub fn no_return_extern_func () -> ! ;
22
+ }
23
+ ```
You can’t perform that action at this time.
0 commit comments