Skip to content

Commit 4a454d6

Browse files
committed
actually take a slice in this example
Fixes #45678
1 parent b8c8f0b commit 4a454d6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/libstd/primitive_docs.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,6 @@ mod prim_array { }
550550
#[doc(alias = "[")]
551551
#[doc(alias = "]")]
552552
#[doc(alias = "[]")]
553-
//
554553
/// A dynamically-sized view into a contiguous sequence, `[T]`.
555554
///
556555
/// *[See also the `std::slice` module](slice/index.html).*
@@ -572,11 +571,11 @@ mod prim_array { }
572571
/// points to:
573572
///
574573
/// ```
575-
/// let x = &mut [1, 2, 3];
574+
/// let mut x = [1, 2, 3];
575+
/// let x = &mut x[..]; // Take a full slice of `x`.
576576
/// x[1] = 7;
577577
/// assert_eq!(x, &[1, 7, 3]);
578578
/// ```
579-
///
580579
#[stable(feature = "rust1", since = "1.0.0")]
581580
mod prim_slice { }
582581

0 commit comments

Comments
 (0)