Files
rust/library/compiler-builtins/libm
Trevor Gross 6d008f38f8 libm: Avoid debug_assert_eq! if feature = "compiler-builtins"
If `fmaf16` is exported, the existing version hits errors like:

    error: `compiler_builtins` cannot call functions through upstream monomorphizations; encountered invalid call from `core::fmt::num::<impl core::fmt::Debug for u64>::fmt` to `core::fmt::num:👿:<impl core::fmt::Display for u64>::fmt`
       --> library/core/src/fmt/num.rs:85:17
        |
     79 | / macro_rules! impl_Debug {
     80 | |     ($($T:ident)*) => {
     81 | |         $(
     82 | |             #[stable(feature = "rust1", since = "1.0.0")]
    ...   |
     85 | |                 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        | |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...   |
     96 | |     };
     97 | | }
        | |_- in this expansion of `impl_Debug!`
    ...
    595 | / impl_Debug! {
    596 | |     i8 i16 i32 i64 i128 isize
    597 | |     u8 u16 u32 u64 u128 usize
    598 | | }
        | |_- in this macro invocation

Presumably this comes from the call to `panicking::assert_failed!` that
needs to be monomorphized. Avoid any formatting by using a plain
`debug_assert!` if we are building the crate as compiler-builtins.
2026-09-17 03:10:23 -04:00
..
…

libm

A Rust implementations of the C math library.

Usage

libm provides fallback implementations for Rust's float math functions in core, and the core_float_math feature. If what is available suits your needs, there is no need to add libm as a dependency.

If more functionality is needed, this crate can also be used directly:

[dependencies]
libm = "0.2.11"

Contributing

Please check CONTRIBUTING.md

Minimum Rust version policy

This crate supports rustc 1.63 and newer.

License

Usage is under the MIT license, available at https://opensource.org/license/mit.

Contribution

Contributions are licensed under both the MIT license and the Apache License, Version 2.0, available at https://www.apache.org/licenses/LICENSE-2.0. Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as mentioned, without any additional terms or conditions.

See LICENSE.txt for full details.