Skip to content

Conversation

@bjoernager
Copy link
Contributor

@bjoernager bjoernager commented Sep 10, 2025

Tracking issue: #116909.

This PR implements FromStr for f128. On the targets that natively support such numbers, this implementation will work as expected. On other targets, a run-time panic will encur for now (this is similarly done for f16 already).

Note that this PR is not currently in a mergeable state.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 10, 2025

r? @scottmcm

rustbot has assigned @scottmcm.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@bjoernager
Copy link
Contributor Author

@rustbot label +F-f16_and_f128 +T-libs-api -T-libs

r? libs-api

@rustbot rustbot added F-f16_and_f128 `#![feature(f16)]`, `#![feature(f128)]` T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Sep 10, 2025
@rustbot rustbot assigned dtolnay and unassigned scottmcm Sep 10, 2025
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-19-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] build_script_build test:false 0.115
[RUSTC-TIMING] cc test:false 0.674
   Compiling compiler_builtins v0.1.160 (/checkout/library/compiler-builtins/compiler-builtins)
[RUSTC-TIMING] build_script_build test:false 0.312
error[E0277]: the trait bound `f128: RawFloat` is not satisfied
   --> library/core/src/num/dec2flt/mod.rs:171:17
    |
110 | / macro_rules! from_str_float_impl {
111 | |     ($($ty:ty)*) => {
112 | |         $(#[stable(feature = "rust1", since = "1.0.0")]
113 | |         impl FromStr for $ty {
...   |
171 | |                 dec2flt(s)
    | |                 ^^^^^^^^^^ the trait `RawFloat` is not implemented for `f128`
...   |
174 | |     };
175 | | }
    | |_- in this expansion of `from_str_float_impl!`
...
182 |   from_str_float_impl!(f128);
    |   -------------------------- in this macro invocation
    |
    = help: the following other types implement trait `RawFloat`:
              f16
              f32
              f64
note: required by a bound in `dec2flt`
   --> library/core/src/num/dec2flt/mod.rs:268:19
    |
268 | pub fn dec2flt<F: RawFloat>(s: &str) -> Result<F, ParseFloatError> {
    |                   ^^^^^^^^ required by this bound in `dec2flt`

For more information about this error, try `rustc --explain E0277`.
[RUSTC-TIMING] core test:false 24.389
error: could not compile `core` (lib) due to 1 previous error
Bootstrap failed while executing `--stage 2 test --skip compiler --skip src`

@bjoernager
Copy link
Contributor Author

Sorry, combining this with #146406 for the sake of maintainability.

@bjoernager bjoernager closed this Sep 10, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 10, 2025
@bjoernager bjoernager reopened this Sep 10, 2025
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 10, 2025
@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-19-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[RUSTC-TIMING] build_script_build test:false 0.128
[RUSTC-TIMING] cc test:false 0.679
   Compiling compiler_builtins v0.1.160 (/checkout/library/compiler-builtins/compiler-builtins)
[RUSTC-TIMING] build_script_build test:false 0.316
error[E0277]: the trait bound `f128: RawFloat` is not satisfied
   --> library/core/src/num/dec2flt/mod.rs:171:17
    |
110 | / macro_rules! from_str_float_impl {
111 | |     ($($ty:ty)*) => {
112 | |         $(#[stable(feature = "rust1", since = "1.0.0")]
113 | |         impl FromStr for $ty {
...   |
171 | |                 dec2flt(s)
    | |                 ^^^^^^^^^^ the trait `RawFloat` is not implemented for `f128`
...   |
174 | |     };
175 | | }
    | |_- in this expansion of `from_str_float_impl!`
...
182 |   from_str_float_impl!(f128);
    |   -------------------------- in this macro invocation
    |
    = help: the following other types implement trait `RawFloat`:
              f16
              f32
              f64
note: required by a bound in `dec2flt`
   --> library/core/src/num/dec2flt/mod.rs:268:19
    |
268 | pub fn dec2flt<F: RawFloat>(s: &str) -> Result<F, ParseFloatError> {
    |                   ^^^^^^^^ required by this bound in `dec2flt`

For more information about this error, try `rustc --explain E0277`.
[RUSTC-TIMING] core test:false 24.281
error: could not compile `core` (lib) due to 1 previous error
Bootstrap failed while executing `--stage 2 test --skip compiler --skip src`

@bjoernager bjoernager closed this Sep 10, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

F-f16_and_f128 `#![feature(f16)]`, `#![feature(f128)]` T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants