about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDion Dokter <diondokter@gmail.com>2024-06-11 13:24:35 +0200
committerDion Dokter <diondokter@gmail.com>2024-06-11 13:24:35 +0200
commitc4391b326edbf4bcf374c9891fb0bfc2bc33531a (patch)
treef454164b62645fb7538e1e266dc9f8335873d926
parent336e6ab3b396e1d1eb9b5a2f0bbc1744f4a68244 (diff)
downloadrust-c4391b326edbf4bcf374c9891fb0bfc2bc33531a.tar.gz
rust-c4391b326edbf4bcf374c9891fb0bfc2bc33531a.zip
Skip fast path for dec2flt when optimize_for_size
-rw-r--r--library/core/src/num/dec2flt/mod.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/library/core/src/num/dec2flt/mod.rs b/library/core/src/num/dec2flt/mod.rs
index a4bc8b1c9b0..c10bf797b57 100644
--- a/library/core/src/num/dec2flt/mod.rs
+++ b/library/core/src/num/dec2flt/mod.rs
@@ -250,8 +250,10 @@ pub fn dec2flt<F: RawFloat>(s: &str) -> Result<F, ParseFloatError> {
         None => return Err(pfe_invalid()),
     };
     num.negative = negative;
-    if let Some(value) = num.try_fast_path::<F>() {
-        return Ok(value);
+    if cfg!(not(feature = "optimize_for_size")) {
+        if let Some(value) = num.try_fast_path::<F>() {
+            return Ok(value);
+        }
     }
 
     // If significant digits were truncated, then we can have rounding error