about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-04-12 12:18:05 +0200
committerGitHub <noreply@github.com>2019-04-12 12:18:05 +0200
commit257dbb826d0000f7d56c71fb7d93b5de288a157e (patch)
treed4c591fdb739d03c8267cf52991a7978f67bf3d2
parentef90d940dc6169c1d505ec5d30d5ad0cab189ccc (diff)
parentf54df449072895f258876adf9545fe3a0840492f (diff)
Rollup merge of #59880 - solson:transmute-float, r=alexcrichton
Remove note about transmute for float bitpatterns.

This particular usecase has been safely abstracted in these `std` functions: [f32::to_bits](https://doc.rust-lang.org/std/primitive.f32.html#method.to_bits), [f32::from_bits](https://doc.rust-lang.org/std/primitive.f32.html#method.from_bits), [f64::to_bits](https://doc.rust-lang.org/std/primitive.f64.html#method.to_bits), [f64::from_bits](https://doc.rust-lang.org/std/primitive.f64.html#method.from_bits). So, I think we shouldn't recommend an unnecessary use of `unsafe` here anymore.
-rw-r--r--src/libcore/intrinsics.rs10
1 files changed, 0 insertions, 10 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index 75a33394e3d..05acd7bd011 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -737,16 +737,6 @@ extern "rust-intrinsic" {
     ///
     /// There are a few things that `transmute` is really useful for.
     ///
-    /// Getting the bitpattern of a floating point type (or, more generally,
-    /// type punning, when `T` and `U` aren't pointers):
-    ///
-    /// ```
-    /// let bitpattern = unsafe {
-    ///     std::mem::transmute::<f32, u32>(1.0)
-    /// };
-    /// assert_eq!(bitpattern, 0x3F800000);
-    /// ```
-    ///
     /// Turning a pointer into a function pointer. This is *not* portable to
     /// machines where function pointers and data pointers have different sizes.
     ///