core: add unstable no_fp_fmt_parse to disable float formatting code by nbdd0121 · Pull Request #86048 · rust-lang/rust

@nbdd0121

They are used by integer formatting as well and is not exclusive to float.

@m-ou-se m-ou-se added T-libs

Relevant to the library team, which will review and decide on the PR/issue.

and removed T-libs-api

Relevant to the library API team, which will review and decide on the PR/issue.

labels

Jun 23, 2021

@bors bors added S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

labels

Jul 2, 2021

@nbdd0121

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 nbdd0121 changed the title core: add unstable no_floating_point to disable float formatting code core: add unstable no_fp_fmt_parse to disable float formatting code

Jul 2, 2021

@ojeda ojeda mentioned this pull request

Jul 4, 2021

55 tasks

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Jul 4, 2021

@Urgau Urgau mentioned this pull request

Jul 4, 2021

This was referenced

Oct 11, 2021

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request

Sep 21, 2022
`alloc`: add unstable cfg features `no_rc` and `no_sync`

In Rust for Linux we are using these to make `alloc` a bit more modular.

See rust-lang#86048 and rust-lang#84266 for similar requests.

Of course, the particular names are not important.

Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request

Sep 21, 2022
`alloc`: add unstable cfg features `no_rc` and `no_sync`

In Rust for Linux we are using these to make `alloc` a bit more modular.

See rust-lang#86048 and rust-lang#84266 for similar requests.

Of course, the particular names are not important.

@GKFX GKFX mentioned this pull request

Oct 16, 2022

thomcc pushed a commit to pgcentralfoundation/postgrestd that referenced this pull request

Feb 10, 2023
`alloc`: add unstable cfg features `no_rc` and `no_sync`

In Rust for Linux we are using these to make `alloc` a bit more modular.

See rust-lang/rust#86048 and rust-lang/rust#84266 for similar requests.

Of course, the particular names are not important.

github-actions bot pushed a commit to tautschnig/verify-rust-std that referenced this pull request

Mar 11, 2025
core: add unstable no_fp_fmt_parse to disable float formatting 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