Stabilizing Rust's Never Type

(lwn.net)

57 points | by cjd8 3 days ago

1 comments

  • epolanski 1 minute ago
    The `never` type seems very useful in various languages to either signal that a branch can never happen (the example of string -> bytestring never erroring) or to mark that a function will never return a value (and thus control) to the caller.

    A simple TypeScript example:

    const forever = (): never => { while (true) { // whatever } }