@@ -147,7 +147,13 @@ macro_rules! from_str_float_impl {
147147 /// representable floating-point number to the number represented
148148 /// by `src` (following the same rules for rounding as for the
149149 /// results of primitive operations).
150- #[ inline]
150+ // We add the `#[inline(never)]` attribute, since its content will
151+ // be filled with that of `dec2flt`, which has #[inline(always)].
152+ // Since `dec2flt` is generic, a normal inline attribute on this function
153+ // with `dec2flt` having no attributes results in heavily repeated
154+ // generation of `dec2flt`, despite the fact only a maximum of 2
155+ // posiible instances. Adding #[inline(never)] avoids this.
156+ #[ inline( never) ]
151157 fn from_str( src: & str ) -> Result <Self , ParseFloatError > {
152158 dec2flt( src)
153159 }
@@ -202,12 +208,14 @@ impl fmt::Display for ParseFloatError {
202208 }
203209}
204210
211+ #[ inline]
205212pub ( super ) fn pfe_empty ( ) -> ParseFloatError {
206213 ParseFloatError { kind : FloatErrorKind :: Empty }
207214}
208215
209216// Used in unit tests, keep public.
210217// This is much better than making FloatErrorKind and ParseFloatError::kind public.
218+ #[ inline]
211219pub fn pfe_invalid ( ) -> ParseFloatError {
212220 ParseFloatError { kind : FloatErrorKind :: Invalid }
213221}
@@ -220,6 +228,7 @@ fn biased_fp_to_float<T: RawFloat>(x: BiasedFp) -> T {
220228}
221229
222230/// Converts a decimal string into a floating point number.
231+ #[ inline( always) ] // Will be inlined into a function with `#[inline(never)]`, see above
223232pub fn dec2flt < F : RawFloat > ( s : & str ) -> Result < F , ParseFloatError > {
224233 let mut s = s. as_bytes ( ) ;
225234 let c = if let Some ( & c) = s. first ( ) {
0 commit comments