If you ready my post carefully, you will see that my argument was based on a future rustc where the bug is fixed.
You always argue with LLVM, but LLVM is just the implementation.
I’m arguing on the language level:
If your type defines that NaN and INF cannot happen, the any optimizer (not just LLVM) can optimize based on that fact. If you are producing an illegal bit pattern and use that value later on, that’s undefined behavior, you cannot just deny that.
I think this is fair, since the contract is only based on convention.
And it requires no unsafe code to break it. It’s possible to produce such garbage values with perfectly legal inputs, using completely innocent operations.
C is such a language and I really don’t want Rust (Rust, the language, not rustc, the compiler) to make even a small step in the direction of allowing UB in safe code.
The big difference is, that an integer cannot represent 1.5, while your type can represent NaN.
And operations on integer cannot produce 1.5, while operations on your type can produce NaN.