36
submitted 5 days ago by jwr1@kbin.earth to c/rust@programming.dev
you are viewing a single comment's thread
view the rest of the comments
[-] SorteKanin@feddit.dk 5 points 4 days ago* (last edited 4 days ago)

I think you're misunderstanding the never type. The never type is not a hack at all. It's a very natural part of the type system. Just as you have the unit type (), which is the canonical type with only 1 value, you also have the never type, the canonical type with 0 values.

This is extremely useful in generic code. See my other comment in this thread.

This is an unfortunate wart to appease a desire to those that want to be able to write code like they do in legacy languages

What do you mean with this? I can't really decipher it. What alternative to the never type would you want?

this post was submitted on 11 Dec 2025
36 points (100.0% liked)

Rust

7572 readers
18 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 2 years ago
MODERATORS