File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -482,8 +482,8 @@ mod prim_pointer { }
482482/// an array. Indeed, this provides most of the API for working with arrays.
483483/// Slices have a dynamic size and do not coerce to arrays.
484484///
485- /// There is no way to move elements out of an array. See [`mem::replace`][replace]
486- /// for an alternative .
485+ /// You can move elements out of an array with a slice pattern. If you want
486+ /// one element, see [`mem::replace`][replace] .
487487///
488488/// # Examples
489489///
@@ -525,6 +525,16 @@ mod prim_pointer { }
525525/// for x in &array { }
526526/// ```
527527///
528+ /// You can use a slice pattern to move elements out of an array:
529+ ///
530+ /// ```
531+ /// fn move_away(_: String) { /* Do interesting things. */ }
532+ ///
533+ /// let [john, roa] = ["John".to_string(), "Roa".to_string()];
534+ /// move_away(john);
535+ /// move_away(roa);
536+ /// ```
537+ ///
528538/// [slice]: primitive.slice.html
529539/// [copy]: marker/trait.Copy.html
530540/// [clone]: clone/trait.Clone.html
You can’t perform that action at this time.
0 commit comments