Syntax
NeverType :!
The never type !
is a type with no values, representing the result of computations that never complete. Expressions of type !
can be coerced into any other type.
let x: ! = panic!(); // Can be coerced into any type. let y: u32 = x;
NB. The never type was expected to be stabilized in 1.41, but due to some last minute regressions detected the stabilization was temporarily reverted. The !
type can only appear in function return types presently. See the tracking issue for more details.
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/reference/types/never.html