Skip to content
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

Make ".e0" not parse as 0.0 #48235

Merged
merged 1 commit into from
Feb 25, 2018
Merged

Conversation

varkor
Copy link
Member

@varkor varkor commented Feb 15, 2018

This forces floats to have either a digit before the separating point, or after. Thus ".e0" is invalid like ".", when using parse(). Fixes #40654. As mentioned in the issue, this is technically a breaking change... but clearly incorrect behaviour at present.

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Feb 15, 2018
@pietroalbini
Copy link
Member

@alexcrichton can we get a review on this PR?

@petrochenkov
Copy link
Contributor

r? @rkruppe

Copy link
Contributor

@hanna-kruppe hanna-kruppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation looks correct (just have one nit with the test), but since this is a behavioral change, I do not feel confident giving r+ and would like a libs team member to OK the potential breakage.

@@ -99,6 +99,8 @@ fn fast_path_correct() {
fn lonely_dot() {
assert!(".".parse::<f32>().is_err());
assert!(".".parse::<f64>().is_err());
assert!(".e0".parse::<f32>().is_err());
assert!(".e0".parse::<f64>().is_err());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't really match the test name IMO. Better create a new test with an appropriate name (or issue_40654 if you, like me, can't think of a good succinct name).

This forces floats to have either a digit before the separating point, or after. Thus ".e0" is invalid like ".", when using `parse()`.
@alexcrichton alexcrichton added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Feb 24, 2018
@alexcrichton
Copy link
Member

Looks good to me, thanks! Let's get a signoff from other libs members on the breaking change aspect, but I'm personally comfortable with a change like this.

@rfcbot fcp merge

@rfcbot
Copy link

rfcbot commented Feb 24, 2018

Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged teams:

No concerns currently listed.

Once a majority of reviewers approve (and none object), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added the proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. label Feb 24, 2018
@alexcrichton alexcrichton added the relnotes Marks issues that should be documented in the release notes of the next release. label Feb 24, 2018
@rfcbot
Copy link

rfcbot commented Feb 25, 2018

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Feb 25, 2018
@alexcrichton
Copy link
Member

@bors: r+

Ok!

@bors
Copy link
Contributor

bors commented Feb 25, 2018

📌 Commit c0e87f1 has been approved by alexcrichton

@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-review Status: Awaiting review from the assignee but also interested parties. labels Feb 25, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Feb 25, 2018
… r=alexcrichton

Make ".e0" not parse as 0.0

This forces floats to have either a digit before the separating point, or after. Thus `".e0"` is invalid like `"."`, when using `parse()`. Fixes rust-lang#40654. As mentioned in the issue, this is technically a breaking change... but clearly incorrect behaviour at present.
bors added a commit that referenced this pull request Feb 25, 2018
Rollup of 17 pull requests

- Successful merges: #47964, #47970, #48076, #48115, #48166, #48281, #48297, #48302, #48362, #48369, #48489, #48491, #48494, #48517, #48529, #48235, #48330
- Failed merges:
@bors bors merged commit c0e87f1 into rust-lang:master Feb 25, 2018
@varkor varkor deleted the parse-float-lonely-exponent branch February 25, 2018 17:59
kdy1 added a commit to kdy1/swc that referenced this pull request Feb 27, 2018
kdy1 added a commit to swc-project/swc that referenced this pull request Feb 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. relnotes Marks issues that should be documented in the release notes of the next release. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

8 participants