-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
formalize FromStr syntax #32243
Comments
At least for float parsing there are comments on the |
The comments are now rendered by rustdoc: https://doc.rust-lang.org/std/primitive.f32.html (scroll down to |
I didn't find a grammar for FromStr for floats however as most likely it would be a bad idea to change the parsing now, it could just be derived from the code and officially documented so users don't have to figure these things out themselves. Maybe as grammar language what was used for the Rust grammar specification could be used, i.e. maybe link that and provide an expression for the valid numbers? Specifically I think it won't be too far away from this. |
i’d like parsing to be more lenient and accept underscores, i guess you only meant parsing shouldn’t get stricter? |
This is a special case of #31821, so closing as part of that. |
- Original bug about documenting grammar - rust-lang#32243 - Known bug with parsing - rust-lang#31407
…ietMisdreavus Add grammar in docs for {f32,f64}::from_str, mention known bug. - Original bug about documenting grammar - rust-lang#32243 - Known bug with parsing - rust-lang#31407
- Original bug about documenting grammar - rust-lang#32243 - Known bug with parsing - rust-lang#31407
AFAIK there’s no grammar specified anywhere that describes how
FromStr
/parse
works.E.g. some didn’t want
f64::from_str(".")
to work (#30344) and I wonder whyi32::from_str("1_000")
does not work.The text was updated successfully, but these errors were encountered: