about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Nordholts <martn@axis.com>2025-02-17 08:00:37 +0100
committerMartin Nordholts <martn@axis.com>2025-02-17 11:59:09 +0100
commitf6485ff6173c1077c0c960361cbf64039f2b5c15 (patch)
tree10960b73ada89b1afc06579a408e1c9fd730a59c
parentd5eb31c9347ae3c494c8d723711dacca7d1cfe8b (diff)
downloadrust-f6485ff6173c1077c0c960361cbf64039f2b5c15.tar.gz
rust-f6485ff6173c1077c0c960361cbf64039f2b5c15.zip
tests: Also gate `f16::erfc()` doctest with `reliable_f16_math` cfg
In 136324 the doctest for `f16::erf()` was gated with
`reliable_f16_math`. Add the same gate on `f16::erfc()` to
avoid:

    rust_out.71e2e529d20ea47d-cgu.0:\
    (.text._ZN8rust_out4main43_doctest_main_library_std_src_f16_rs_1321_017h485f3ffe6bf2a981E+0x38): \
    undefined reference to `__gnu_h2f_ieee'

on MIPS (and maybe other architectures).
-rw-r--r--library/std/src/f16.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/library/std/src/f16.rs b/library/std/src/f16.rs
index bdbe3e21994..0af69dff05a 100644
--- a/library/std/src/f16.rs
+++ b/library/std/src/f16.rs
@@ -1321,12 +1321,14 @@ impl f16 {
     /// ```
     /// #![feature(f16)]
     /// #![feature(float_erf)]
+    /// # #[cfg(reliable_f16_math)] {
     /// let x: f16 = 0.123;
     ///
     /// let one = x.erf() + x.erfc();
     /// let abs_difference = (one - 1.0).abs();
     ///
     /// assert!(abs_difference <= f16::EPSILON);
+    /// # }
     /// ```
     #[rustc_allow_incoherent_impl]
     #[must_use = "method returns a new number and does not mutate the original value"]