Skip to content

Commit 1798d51

Browse files
committed
Add grammar for {f32,f64}::from_str, mention known bug.
- Original bug about documenting grammar - #32243 - Known bug with parsing - #31407
1 parent e9bca7a commit 1798d51

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/libcore/num/dec2flt/mod.rs

+25-1
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,35 @@ macro_rules! from_str_float_impl {
122122
/// * '2.5E10', or equivalently, '2.5e10'
123123
/// * '2.5E-10'
124124
/// * '5.'
125-
/// * '.5', or, equivalently, '0.5'
125+
/// * '.5', or, equivalently, '0.5'
126126
/// * 'inf', '-inf', 'NaN'
127127
///
128128
/// Leading and trailing whitespace represent an error.
129129
///
130+
/// # Grammar
131+
///
132+
/// All strings that adhere to the following regular expression
133+
/// will result in an [`Ok`] being returned:
134+
///
135+
/// ```txt
136+
/// (\+|-)?
137+
/// (inf|
138+
/// NaN|
139+
/// ([0-9]+|
140+
/// [0-9]+\.[0-9]*|
141+
/// [0-9]*\.[0-9]+)
142+
/// ((e|E)
143+
/// (\+|-)?
144+
/// [0-9]+)?)
145+
/// ```
146+
///
147+
/// # Known bugs
148+
///
149+
/// * [#31407]: Some strings that adhere to the regular expression
150+
/// above will incorrectly return an [`Err`].
151+
///
152+
/// [#31407]: https://github.com/rust-lang/rust/issues/31407
153+
///
130154
/// # Arguments
131155
///
132156
/// * src - A string

0 commit comments

Comments
 (0)