about summary refs log tree commit diff
diff options
context:
space:
mode:
authorubsan <npmazzuca@gmail.com>2016-07-05 16:04:58 -0700
committerubsan <npmazzuca@gmail.com>2016-07-05 16:04:58 -0700
commit451af791dadf5a38da2fe63d578c083b95d6c10a (patch)
tree60d2729b827d9a444b1edcbb3e509433106d206e
parent15a49fefcb29590554d69081a7e26fcf4bfa0f65 (diff)
downloadrust-451af791dadf5a38da2fe63d578c083b95d6c10a.tar.gz
rust-451af791dadf5a38da2fe63d578c083b95d6c10a.zip
Fix links, change example to english
-rw-r--r--src/libcore/intrinsics.rs27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index fd2d9cdb0d4..875fa08f789 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -278,32 +278,21 @@ extern "rust-intrinsic" {
     /// Moves a value out of scope without running drop glue.
     pub fn forget<T>(_: T) -> ();
 
-    /// Reinterprets the bits of a value of one type as another type. Both types
+    /// Reinterprets the bits of a value of one type as another type; both types
     /// must have the same size. Neither the original, nor the result, may be an
-    /// [invalid value]
-    /// (https://doc.rust-lang.org/nomicon/meet-safe-and-unsafe.html).
+    /// [invalid value] (../../nomicon/meet-safe-and-unsafe.html).
     ///
-    /// `transmute` is semantically equivalent to the following:
-    ///
-    /// ```
-    /// use std::{mem, ptr};
-    /// // assuming that T and U are the same size
-    /// unsafe fn transmute<T, U>(t: T) -> U {
-    ///     let mut u: U = mem::uninitialized();
-    ///     ptr::copy_nonoverlapping(&t as *const T as *const u8,
-    ///                              &mut u as *mut U as *mut u8,
-    ///                              mem::size_of::<T>());
-    ///     mem::forget(t);
-    ///     u
-    /// }
-    /// ```
+    /// `transmute` is semantically equivalent to a bitwise move of one type
+    /// into another. It copies the bits from the destination type into the
+    /// source type, then forgets the original. If you know C or C++, it's like
+    /// `memcpy` under the hood.
     ///
     /// `transmute` is incredibly unsafe. There are a vast number of ways to
     /// cause undefined behavior with this function. `transmute` should be
     /// the absolute last resort.
     ///
-    /// The [nomicon](https://doc.rust-lang.org/nomicon/transmutes.html) has
-    /// additional documentation.
+    /// The [nomicon](../../nomicon/transmutes.html) has additional
+    /// documentation.
     ///
     /// # Alternatives
     ///