-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Add grammar in docs for {f32,f64}::from_str, mention known bug. #56217
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1798d51
Add grammar for {f32,f64}::from_str, mention known bug.
frewsxcv 694b18d
tweak 'known issues' wording
frewsxcv 15f79d8
...and fix a link
frewsxcv 1027dc1
Update regex to EBNF
frewsxcv 55be692
Update src/libcore/num/dec2flt/mod.rs
Centril 8af02fa
reposition markdown hyperlink reference
frewsxcv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -122,11 +122,35 @@ macro_rules! from_str_float_impl { | |
/// * '2.5E10', or equivalently, '2.5e10' | ||
/// * '2.5E-10' | ||
/// * '5.' | ||
/// * '.5', or, equivalently, '0.5' | ||
/// * '.5', or, equivalently, '0.5' | ||
/// * 'inf', '-inf', 'NaN' | ||
/// | ||
/// Leading and trailing whitespace represent an error. | ||
/// | ||
/// # Grammar | ||
/// | ||
/// All strings that adhere to the following [EBNF] grammar | ||
/// will result in an [`Ok`] being returned: | ||
/// | ||
/// ```txt | ||
/// Float ::= Sign? ( 'inf' | 'NaN' | Number ) | ||
/// Number ::= ( Digit+ | | ||
/// Digit+ '.' Digit* | | ||
/// Digit* '.' Digit+ ) Exp? | ||
/// Exp ::= [eE] Sign? Digit+ | ||
/// Sign ::= [+-] | ||
/// Digit ::= [0-9] | ||
/// ``` | ||
/// | ||
/// [EBNF]: https://www.w3.org/TR/REC-xml/#sec-notation | ||
/// | ||
/// # Known bugs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Historically, we haven't mentioned known bugs in the docs, but considering this known bug has existed for years and people keep hitting it, I think it's worth calling it out here. |
||
/// | ||
/// In some situations, some strings that should create a valid float | ||
/// instead return an error. See [issue #31407] for details. | ||
/// | ||
/// [issue #31407]: https://github.com/rust-lang/rust/issues/31407 | ||
/// | ||
/// # Arguments | ||
/// | ||
/// * src - A string | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.