diff options
| author | ubsan <npmazzuca@gmail.com> | 2016-07-10 23:17:02 +0200 |
|---|---|---|
| committer | ubsan <npmazzuca@gmail.com> | 2016-07-10 23:17:02 +0200 |
| commit | c0bee60adbf979ae624cfcdc7610044c357794a0 (patch) | |
| tree | ab3b7adf29c207b3c1d7aee69bb502cdb6aa922b | |
| parent | 97003e56991d3e475f2d4bb18a88c768018041e9 (diff) | |
| download | rust-c0bee60adbf979ae624cfcdc7610044c357794a0.tar.gz rust-c0bee60adbf979ae624cfcdc7610044c357794a0.zip | |
Make it nicer from @alexandermerritt
| -rw-r--r-- | src/libcore/intrinsics.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index ab7545d37dc..d6fb1816b5f 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -339,11 +339,11 @@ extern "rust-intrinsic" { /// # Alternatives /// /// However, many uses of `transmute` can be achieved through other means. - /// This is unfortunate because either `transmute` isn't guaranteed to work - /// in that case, and only does because of rustc's current implemenation; - /// or, more commonly, `transmute` is just too powerful. It can transform + /// `transmute` can transform /// any type into any other, with just the caveat that they're the same - /// size. Some more or less common uses, and a better way, are as follows: + /// size, and it sometimes results in interesting results. Below are common + /// applications of `transmute` which can be replaced with safe applications + /// of `as`: /// /// Turning a pointer into a `usize`: /// @@ -374,7 +374,8 @@ extern "rust-intrinsic" { /// let val_transmuted = unsafe { /// std::mem::transmute::<&mut i32, &mut u32>(ptr) /// }; - /// // Now, put together `as` and reborrowing + /// // Now, put together `as` and reborrowing - note the chaining of `as` + /// // `as` is not transitive /// let val_casts = unsafe { &mut *(ptr as *mut i32 as *mut u32) }; /// ``` /// |
