News for hackers. Stuff that matters.
Re:Weird Expressions in Rust by nine_k on Saturday June 28, 2025 @01:15PM (#44406358)
This is logically sound, but pragmatically not so. I wish the compiler could issue a warning or even an error if an expression of type `never` is used in a logical condition, like that of an `if`. While such cases might have rare legitimate uses (e.g. some edge cases of macro expansion, etc), I'd like it to be marked explicitly, similar to `unsafe`, e.g. with some `allow_never_as_condition` marker.

Likely the same should apply to expressions of type `()`.

There are no comments on this comment yet.