Skip to content

Commit 6928bbb

Browse files
committed
Fix some other small nits
1 parent 233b45f commit 6928bbb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/libcore/intrinsics.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ extern "rust-intrinsic" {
316316
/// // turning a pointer into a usize
317317
/// let ptr = &0;
318318
/// let ptr_num_transmute = std::mem::transmute::<&i32, usize>(ptr);
319-
/// // now with more `as`
319+
/// // Use `as` casts instead
320320
/// let ptr_num_cast = ptr as *const i32 as usize;
321321
///
322322
///
@@ -330,15 +330,15 @@ extern "rust-intrinsic" {
330330
/// // Turning an &mut T into an &mut U
331331
/// let ptr = &mut 0;
332332
/// let val_transmuted = std::mem::transmute::<&mut i32, &mut u32>(ptr);
333-
/// // Reborrowing continues to play a role here, but now we add `as` casts
333+
/// // Now let's put together `as` and reborrowing
334334
/// let val_casts = &mut *(ptr as *mut i32 as *mut u32);
335335
///
336336
///
337337
/// // Turning an `&str` into an `&[u8]`
338+
/// // this is not a good way to do this.
338339
/// let slice = unsafe { mem::transmute::<&str, &[u8]>("Rust") };
339340
/// assert_eq!(slice, [82, 117, 115, 116]);
340-
/// // this is not a good way to do this.
341-
/// // use .as_bytes()
341+
/// // You could use `str::as_bytes`
342342
/// let slice = "Rust".as_bytes();
343343
/// assert_eq!(slice, [82, 117, 115, 116]);
344344
/// // Or, just use a byte string, if you have control over the string

0 commit comments

Comments
 (0)