Skip to content

Commit 15a49fe

Browse files
committed
Tone it down a little
1 parent 8c7668a commit 15a49fe

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

src/libcore/intrinsics.rs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ extern "rust-intrinsic" {
283283
/// [invalid value]
284284
/// (https://doc.rust-lang.org/nomicon/meet-safe-and-unsafe.html).
285285
///
286-
/// `transmute::<T, U>(t)` is semantically equivalent to the following:
286+
/// `transmute` is semantically equivalent to the following:
287287
///
288288
/// ```
289289
/// use std::{mem, ptr};
@@ -303,7 +303,7 @@ extern "rust-intrinsic" {
303303
/// the absolute last resort.
304304
///
305305
/// The [nomicon](https://doc.rust-lang.org/nomicon/transmutes.html) has
306-
/// more complete documentation. Read it before using `transmute`.
306+
/// additional documentation.
307307
///
308308
/// # Alternatives
309309
///
@@ -343,13 +343,13 @@ extern "rust-intrinsic" {
343343
/// ```
344344
/// // this is not a good way to do this.
345345
/// let slice = unsafe { mem::transmute::<&str, &[u8]>("Rust") };
346-
/// assert_eq!(slice, [82, 117, 115, 116]);
346+
/// assert_eq!(slice, &[82, 117, 115, 116]);
347347
/// // You could use `str::as_bytes`
348348
/// let slice = "Rust".as_bytes();
349-
/// assert_eq!(slice, [82, 117, 115, 116]);
349+
/// assert_eq!(slice, &[82, 117, 115, 116]);
350350
/// // Or, just use a byte string, if you have control over the string
351351
/// // literal
352-
/// assert_eq!(b"Rust", [82, 117, 116, 116]);
352+
/// assert_eq!(b"Rust", &[82, 117, 116, 116]);
353353
/// ```
354354
///
355355
/// Turning a `Vec<&T>` into a `Vec<Option<&T>>`:
@@ -373,7 +373,7 @@ extern "rust-intrinsic" {
373373
/// // exact same size, and the same or lesser alignment, as the old
374374
/// // type. The same caveats exist for this method as transmute, for
375375
/// // the original inner type (`&i32`) to the converted inner type
376-
/// // (`Option<&i32>`), so read the nomicon page linked above.
376+
/// // (`Option<&i32>`), so read the nomicon pages linked above.
377377
/// let v_from_raw = Vec::from_raw_parts(v_orig.as_mut_ptr(),
378378
/// v_orig.len(),
379379
/// v_orig.capacity());
@@ -441,7 +441,7 @@ extern "rust-intrinsic" {
441441
/// assert_eq!(bitpattern, 0x3F800000);
442442
/// ```
443443
///
444-
/// Turning a pointer into a function pointer (this isn't guaranteed to
444+
/// Turning a pointer into a function pointer (this is not guaranteed to
445445
/// work in Rust, although, for example, Linux does make this guarantee):
446446
///
447447
/// ```
@@ -453,8 +453,8 @@ extern "rust-intrinsic" {
453453
/// assert_eq!(function(), 0);
454454
/// ```
455455
///
456-
/// Extending a lifetime, or shortening an invariant an invariant lifetime;
457-
/// this is advanced, very unsafe rust:
456+
/// Extending a lifetime, or shortening an invariant lifetime; this is
457+
/// advanced, very unsafe rust:
458458
///
459459
/// ```
460460
/// use std::mem;
@@ -464,11 +464,10 @@ extern "rust-intrinsic" {
464464
/// mem::transmute::<R<'b>, R<'static>>(ptr);
465465
/// }
466466
///
467-
/// unsafe fn shorten_invariant<'b, 'c>(r: &'b mut R<'static>)
468-
/// -> &'b R<'c> {
469-
/// let ref_to_original =
470-
/// mem::transmute::<&'b mut R<'static>, &'b mut R<'c>>(
471-
/// ref_to_extended);
467+
/// unsafe fn shorten_invariant_lifetime<'b, 'c>(r: &'b mut R<'static>)
468+
/// -> &'b mut R<'c> {
469+
/// mem::transmute::<&'b mut R<'static>, &'b mut R<'c>>(
470+
/// ref_to_extended)
472471
/// }
473472
/// ```
474473
#[stable(feature = "rust1", since = "1.0.0")]

0 commit comments

Comments
 (0)