about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-06-19 08:34:50 +0000
committerbors <bors@rust-lang.org>2020-06-19 08:34:50 +0000
commit63b441aafbf52d6ba789ecc478455800c1a48df9 (patch)
tree522aba5368c067b64995b45a91f3e4e5587bfe3a /src/libstd
parenta39c7787ba246353178e099373b9240be0d9e603 (diff)
parent028c908991125742c4acc38b7a3108a1d1133771 (diff)
downloadrust-63b441aafbf52d6ba789ecc478455800c1a48df9.tar.gz
rust-63b441aafbf52d6ba789ecc478455800c1a48df9.zip
Auto merge of #73498 - RalfJung:rollup-1mfjcju, r=RalfJung
Rollup of 13 pull requests

Successful merges:

 - #70740 (Enabling static-pie for musl)
 - #72331 (Report error when casting an C-like enum implementing Drop)
 - #72486 (Fix asinh of negative values)
 - #72497 (tag/niche terminology cleanup)
 - #72999 (Create self-contained directory and move there some of external binaries/libs)
 - #73130 (Remove const prop for indirects)
 - #73142 (Ensure std benchmarks get tested.)
 - #73305 (Disallow loading crates with non-ascii identifier name.)
 - #73346 (Add rust specific features to print target features)
 - #73362 (Test that bounds checks are elided when slice len is checked up-front)
 - #73459 (Reduce pointer casts in Box::into_boxed_slice)
 - #73464 (Document format correction)
 - #73479 (Minor tweaks to liballoc)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/Cargo.toml5
-rw-r--r--src/libstd/f32.rs8
-rw-r--r--src/libstd/f64.rs8
-rw-r--r--src/libstd/sys/unix/ext/fs.rs6
4 files changed, 15 insertions, 12 deletions
diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml
index 83029a86420..490afb5a043 100644
--- a/src/libstd/Cargo.toml
+++ b/src/libstd/Cargo.toml
@@ -74,3 +74,8 @@ std_detect_dlsym_getauxval = []
 threads = 125
 # Maximum heap size
 heap_size = 0x8000000
+
+[[bench]]
+name = "stdbenches"
+path = "benches/lib.rs"
+test = true
diff --git a/src/libstd/f32.rs b/src/libstd/f32.rs
index d752ba89a27..b392d6e7226 100644
--- a/src/libstd/f32.rs
+++ b/src/libstd/f32.rs
@@ -832,11 +832,7 @@ impl f32 {
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn asinh(self) -> f32 {
-        if self == Self::NEG_INFINITY {
-            Self::NEG_INFINITY
-        } else {
-            (self + ((self * self) + 1.0).sqrt()).ln().copysign(self)
-        }
+        (self.abs() + ((self * self) + 1.0).sqrt()).ln().copysign(self)
     }
 
     /// Inverse hyperbolic cosine function.
@@ -1413,6 +1409,8 @@ mod tests {
         assert!((-0.0f32).asinh().is_sign_negative()); // issue 63271
         assert_approx_eq!(2.0f32.asinh(), 1.443635475178810342493276740273105f32);
         assert_approx_eq!((-2.0f32).asinh(), -1.443635475178810342493276740273105f32);
+        // regression test for the catastrophic cancellation fixed in 72486
+        assert_approx_eq!((-3000.0f32).asinh(), -8.699514775987968673236893537700647f32);
     }
 
     #[test]
diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs
index 9cd60d846a7..72268d2cc2f 100644
--- a/src/libstd/f64.rs
+++ b/src/libstd/f64.rs
@@ -834,11 +834,7 @@ impl f64 {
     #[stable(feature = "rust1", since = "1.0.0")]
     #[inline]
     pub fn asinh(self) -> f64 {
-        if self == Self::NEG_INFINITY {
-            Self::NEG_INFINITY
-        } else {
-            (self + ((self * self) + 1.0).sqrt()).ln().copysign(self)
-        }
+        (self.abs() + ((self * self) + 1.0).sqrt()).ln().copysign(self)
     }
 
     /// Inverse hyperbolic cosine function.
@@ -1442,6 +1438,8 @@ mod tests {
         // issue 63271
         assert_approx_eq!(2.0f64.asinh(), 1.443635475178810342493276740273105f64);
         assert_approx_eq!((-2.0f64).asinh(), -1.443635475178810342493276740273105f64);
+        // regression test for the catastrophic cancellation fixed in 72486
+        assert_approx_eq!((-67452098.07139316f64).asinh(), -18.72007542627454439398548429400083);
     }
 
     #[test]
diff --git a/src/libstd/sys/unix/ext/fs.rs b/src/libstd/sys/unix/ext/fs.rs
index 732cd677a18..e4d71493604 100644
--- a/src/libstd/sys/unix/ext/fs.rs
+++ b/src/libstd/sys/unix/ext/fs.rs
@@ -242,7 +242,8 @@ pub trait PermissionsExt {
     ///     let permissions = metadata.permissions();
     ///
     ///     println!("permissions: {:o}", permissions.mode());
-    ///     Ok(()) }
+    ///     Ok(())
+    /// }
     /// ```
     #[stable(feature = "fs_ext", since = "1.1.0")]
     fn mode(&self) -> u32;
@@ -262,7 +263,8 @@ pub trait PermissionsExt {
     ///
     ///     permissions.set_mode(0o644); // Read/write for owner and read for others.
     ///     assert_eq!(permissions.mode(), 0o644);
-    ///     Ok(()) }
+    ///     Ok(())
+    /// }
     /// ```
     #[stable(feature = "fs_ext", since = "1.1.0")]
     fn set_mode(&mut self, mode: u32);