Skip to content
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

core: add unstable no_fp_fmt_parse to disable float formatting code #86048

Merged
merged 2 commits into from
Jul 4, 2021

Commits on Jun 6, 2021

  1. Move flt2dec::{Formatted, Part} to dedicated module

    They are used by integer formatting as well and is not exclusive to float.
    nbdd0121 committed Jun 6, 2021
    Configuration menu
    Copy the full SHA
    37647d1 View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2021

  1. core: add unstable no_fp_fmt_parse to disable float fmt/parse code

    In some projects (e.g. kernel), floating point is forbidden. They can disable
    hardware floating point support and use `+soft-float` to avoid fp instructions
    from being generated, but as libcore contains the formatting code for `f32`
    and `f64`, some fp intrinsics are depended. One could define stubs for these
    intrinsics that just panic [1], but it means that if any formatting functions
    are accidentally used, mistake can only be caught during the runtime rather
    than during compile-time or link-time, and they consume a lot of space without
    LTO.
    
    This patch provides an unstable cfg `no_fp_fmt_parse` to disable these.
    A panicking stub is still provided for the `Debug` implementation (unfortunately)
    because there are some SIMD types that use `#[derive(Debug)]`.
    
    [1]: https://lkml.org/lkml/2021/4/14/1028
    nbdd0121 committed Jul 2, 2021
    Configuration menu
    Copy the full SHA
    ec7292a View commit details
    Browse the repository at this point in the history