Skip to content

Commit ad43204

Browse files
frewsxcvVardhan Thigle
authored andcommitted
Add grammar for {f32,f64}::from_str, mention known bug.
- Original bug about documenting grammar - rust-lang#32243 - Known bug with parsing - rust-lang#31407
1 parent ccafca6 commit ad43204

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/libcore/num/dec2flt/mod.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,35 @@ macro_rules! from_str_float_impl {
112112
/// * '2.5E10', or equivalently, '2.5e10'
113113
/// * '2.5E-10'
114114
/// * '5.'
115-
/// * '.5', or, equivalently, '0.5'
115+
/// * '.5', or, equivalently, '0.5'
116116
/// * 'inf', '-inf', 'NaN'
117117
///
118118
/// Leading and trailing whitespace represent an error.
119119
///
120+
/// # Grammar
121+
///
122+
/// All strings that adhere to the following regular expression
123+
/// will result in an [`Ok`] being returned:
124+
///
125+
/// ```txt
126+
/// (\+|-)?
127+
/// (inf|
128+
/// NaN|
129+
/// ([0-9]+|
130+
/// [0-9]+\.[0-9]*|
131+
/// [0-9]*\.[0-9]+)
132+
/// ((e|E)
133+
/// (\+|-)?
134+
/// [0-9]+)?)
135+
/// ```
136+
///
137+
/// # Known bugs
138+
///
139+
/// * [#31407]: Some strings that adhere to the regular expression
140+
/// above will incorrectly return an [`Err`].
141+
///
142+
/// [#31407]: https://github.com/rust-lang/rust/issues/31407
143+
///
120144
/// # Arguments
121145
///
122146
/// * src - A string

0 commit comments

Comments
 (0)