-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
".".parse() returns Ok(0.0) #30344
Comments
I'd rather not go down the PHP route and document bugs as features, even minor ones like this. |
triage: I-nominated |
The libs team discussed this during triage yesterday and the conclusion is that this is pretty reasonable to include in the future as a bugfix, so P-medium for now. |
This is an ideal E-easy bug, and although it's quite small I can mentor for this if desired. So, someone please tag this E-easy E-mentor. Details for someone looking to fix this bug: |
E-easy -- can I take this one? |
Go for it! |
Absolutely! If you have questions or run into problems, you can ping me on IRC (my IRC nick is the same as my username here) or if I'm not online on IRC , comment here. |
@rkruppe Thanks :) I'm playing with the code, and this indeed looks easy. However, the build time is insane for such a small change (maybe because libcore compilation forces almost all other modules to compile?). I'm just doing Also, do we want to spit a warning at this point or just return |
There's no way to make build times good, but you can make it less insane by rebuilding less. As for warning: It would be nice to have a grace period, but I don't see a good way to do it. Since this is a runtime condition, the warning would be shown to the users, not to the developers. Also, how would we even report the warning? Just printing to a running process's stderr is extremely rude — and also not really possibly in libcore. @alexcrichton what do you think? |
Make `".".parse::<f32>()` and `".".parse::<f64>()` return Err This fixes #30344. This is a [breaking-change], which the libs team have classified as a bug fix.
Sorry that I just jumped in and did this @yati-sagade, I didn't realise someone else was doing it until I was opening the PR. |
@Toby-s No problem. I didn't realize that returning |
This program prints
Ok(0)
where I would expect anErr(..)
:If I remember correctly, this behavior has been around since pre-1.0 but it would be good if someone who has
multirust
available could verify that (at least for 1.0 final if earlier builds are harder to get).Unfortunately even if we all agree that this behavior is wrong, it may not be worth the potential breakage to fix. For example, recent changes to the integer
FromStr
format (allowing leading plus) did, surprisingly, break real code. It's quite possible that fixing this wart is not worth the risk.The text was updated successfully, but these errors were encountered: