diff options
| author | Corey Farwell <coreyf@rwell.org> | 2018-11-25 11:35:38 -0500 |
|---|---|---|
| committer | Corey Farwell <coreyf@rwell.org> | 2018-11-25 12:54:49 -0500 |
| commit | 1798d51da67835618079f034d0b552be342af5d2 (patch) | |
| tree | dec40c91b5191ac343ae62cc7f619d49689b139b | |
| parent | e9bca7a993d740291568c57eeef797b175c591cf (diff) | |
| download | rust-1798d51da67835618079f034d0b552be342af5d2.tar.gz rust-1798d51da67835618079f034d0b552be342af5d2.zip | |
Add grammar for {f32,f64}::from_str, mention known bug.
- Original bug about documenting grammar - https://github.com/rust-lang/rust/issues/32243 - Known bug with parsing - https://github.com/rust-lang/rust/issues/31407
| -rw-r--r-- | src/libcore/num/dec2flt/mod.rs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/libcore/num/dec2flt/mod.rs b/src/libcore/num/dec2flt/mod.rs index f93564c2849..64ac69946d1 100644 --- a/src/libcore/num/dec2flt/mod.rs +++ b/src/libcore/num/dec2flt/mod.rs @@ -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 regular expression + /// will result in an [`Ok`] being returned: + /// + /// ```txt + /// (\+|-)? + /// (inf| + /// NaN| + /// ([0-9]+| + /// [0-9]+\.[0-9]*| + /// [0-9]*\.[0-9]+) + /// ((e|E) + /// (\+|-)? + /// [0-9]+)?) + /// ``` + /// + /// # Known bugs + /// + /// * [#31407]: Some strings that adhere to the regular expression + /// above will incorrectly return an [`Err`]. + /// + /// [#31407]: https://github.com/rust-lang/rust/issues/31407 + /// /// # Arguments /// /// * src - A string |
