diff options
| author | ubsan <npmazzuca@gmail.com> | 2016-07-02 00:00:04 -0700 |
|---|---|---|
| committer | ubsan <npmazzuca@gmail.com> | 2016-07-02 00:00:04 -0700 |
| commit | 6928bbba3a51db12aceb90d3c99dbec1383ce2dc (patch) | |
| tree | ae16795288b53f5ab98ff8003df024cc64e5ac24 | |
| parent | 233b45f0d714e0fd48b297a531bc57138d524a3a (diff) | |
| download | rust-6928bbba3a51db12aceb90d3c99dbec1383ce2dc.tar.gz rust-6928bbba3a51db12aceb90d3c99dbec1383ce2dc.zip | |
Fix some other small nits
| -rw-r--r-- | src/libcore/intrinsics.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index c7ea5e9da64..3cc113f5e0a 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -316,7 +316,7 @@ extern "rust-intrinsic" { /// // turning a pointer into a usize /// let ptr = &0; /// let ptr_num_transmute = std::mem::transmute::<&i32, usize>(ptr); - /// // now with more `as` + /// // Use `as` casts instead /// let ptr_num_cast = ptr as *const i32 as usize; /// /// @@ -330,15 +330,15 @@ extern "rust-intrinsic" { /// // Turning an &mut T into an &mut U /// let ptr = &mut 0; /// let val_transmuted = std::mem::transmute::<&mut i32, &mut u32>(ptr); - /// // Reborrowing continues to play a role here, but now we add `as` casts + /// // Now let's put together `as` and reborrowing /// let val_casts = &mut *(ptr as *mut i32 as *mut u32); /// /// /// // Turning an `&str` into an `&[u8]` + /// // this is not a good way to do this. /// let slice = unsafe { mem::transmute::<&str, &[u8]>("Rust") }; /// assert_eq!(slice, [82, 117, 115, 116]); - /// // this is not a good way to do this. - /// // use .as_bytes() + /// // You could use `str::as_bytes` /// let slice = "Rust".as_bytes(); /// assert_eq!(slice, [82, 117, 115, 116]); /// // Or, just use a byte string, if you have control over the string |
