-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Floating-point abs() and friends not part of no_std prelude #34766
Comments
That's because the inherent methods are in std. They're defined in |
Yes, I know that... the exact same situation exists for SliceExt. That isn't the complete story, though: SliceExt is part of the prelude, so the methods are usable. |
I do not believe In other words, I deliberately did not address Edit: Huh, the tracking issue talks about both of these traits (and others?) as being in the same situation, so maybe my impression was wrong. Still, I find some factual differences in their API which I edited into the first paragraph. |
core::num::Float::abs is stable, for what it's worth. The whole situation is kind of messy, though.
We moved all of those to libstd; libcore just contains the ones which are implemented natively in Rust. |
Obviously libcore doesn't contain those which require libc, but for stabilization one would probably want a more sensible criterion for what's in core other than "everything that can be with the current implementation". |
This should be closed? Equivalent to #39473. |
Yes, I'm going to close this as equivalent to #39473, that is, the path here is to move to not using libm intrinsics for these functions. |
The current open issue for this is #50145. |
It is actually possible to write
core::num::Float::abs(x)
, but I'm not sure that's actually supposed to be legal, and at that point, you might as well just write your own abs() function.The text was updated successfully, but these errors were encountered: