Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up".".parse() returns Ok(0.0) #30344
Comments
rkruppe
changed the title
"." is successfully parsed as float
"." is parsed as 0.0
Dec 11, 2015
rkruppe
changed the title
"." is parsed as 0.0
".".from_str() returns Ok(0.0)
Dec 11, 2015
rkruppe
changed the title
".".from_str() returns Ok(0.0)
".".parse() returns Ok(0.0)
Dec 11, 2015
apasel422
added
the
A-libs
label
Dec 12, 2015
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
I'd rather not go down the PHP route and document bugs as features, even minor ones like this. |
This comment has been minimized.
This comment has been minimized.
|
triage: I-nominated |
rust-highfive
added
the
I-nominated
label
Dec 12, 2015
alexcrichton
added
the
T-libs
label
Dec 12, 2015
This comment has been minimized.
This comment has been minimized.
|
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. |
alexcrichton
added
P-medium
and removed
I-nominated
labels
Dec 17, 2015
This comment has been minimized.
This comment has been minimized.
|
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: |
bluss
added
E-easy
E-mentor
labels
Dec 18, 2015
This comment has been minimized.
This comment has been minimized.
yati-sagade
commented
Dec 18, 2015
|
E-easy -- can I take this one? |
This comment has been minimized.
This comment has been minimized.
|
Go for it! |
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
yati-sagade
commented
Dec 23, 2015
|
@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 |
This comment has been minimized.
This comment has been minimized.
|
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? |
Toby-S
referenced this issue
Jan 3, 2016
Merged
Make ".".parse::<f32>() and ".".parse::<f64>() return Err #30681
bors
added a commit
that referenced
this issue
Jan 4, 2016
bors
closed this
in
#30681
Jan 5, 2016
This comment has been minimized.
This comment has been minimized.
|
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. |
This comment has been minimized.
This comment has been minimized.
yati-sagade
commented
Jan 5, 2016
|
@Toby-S No problem. I didn't realize that returning |
rkruppe commentedDec 11, 2015
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
multirustavailable 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
FromStrformat (allowing leading plus) did, surprisingly, break real code. It's quite possible that fixing this wart is not worth the risk.