-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove floating point modulus as a built-in operation; relegate it to the libraries #12278
Comments
I don't think it should be removed if it can be well-defined and is sometimes useful. The modulus operator can be overloaded in a library anyway, so whether or not it's built-in to the compiler only changes constant evaluation since CTFE isn't part of Rust. |
I highly doubt anyone will notice it gone. I don't think we should be making design decisions to keep obscure features based on CTFE concerns. For example, |
I don't care whether or not it's built-in to the language. I just don't want it completely removed as the bessel functions were. It's absolutely trivial to support it and the API design is very clear cut. |
I'd like to at least have the operator overloaded by the traits even if it's not directly in the compiler, e.g. Python offers it >>> 1.5 % 0.4
0.29999999999999993 |
Accepted for P-backcompat-lang, 1.0. |
This commit removes the compiler support for floating point modulus operations, as well as from the language. An implementation for this operator is now required to be provided by libraries. Floating point modulus is rarely used, doesn't exist in C, and is always lowered to an fmod library call by LLVM, and LLVM is considering removing support entirely. Closes #12278
[`mem_replace_with_default`] No longer triggers on unused expression changelog:[`mem_replace_with_default`]: No longer triggers on unused expression Change [`mem_replace_with_default`] to not trigger on unused expression because the lint from `#[must_use]` handle this case better. fixes: rust-lang#5586
Floating point modulus is rarely used, doesn't exist in C, and is always lowered to an fmod library call. LLVM is considering removing support entirely. Nominating.
The text was updated successfully, but these errors were encountered: