Move libm bindings into separate crate #40798
Labels
C-cleanup
Category: PRs that clean code up or issues documenting cleanup.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
It is a followup for #39473
There is Rust cleanup activity that aims to move complex, platform-specific dependencies outside of
std
. For exampleslibc
bindings were moved to its own crate andstd
links to it.It worth checking if similar thing can be done for
libm
dependency. Decouplinglibm
library fromstd
has advantages:libm
will have its own release cycle independent of the Rust one. If there is a bug inlibm
crate then it can be released separately without waiting for a new Rust release.libm
has more freedom over its implementation. Initiallylibm
is going to be just a wrapper over system shared library. But it is be possible to create a version that statically links to openlibm and avoid dynamic linking. It would be great to see a libm version implemented fully in Rust, similar to what math.rs tries to achieve. And users could switch between libm implementation depending on their requirements.Another question - do math functions like hyperbolic cosine need to be part of std at all? Would it make more sense to remove
libm
dependency from std completely and let users plug math crate manually instead?The text was updated successfully, but these errors were encountered: