about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-04-21 15:23:15 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-04-21 15:23:15 -0700
commit1a6c18d6608933240d964a1d1a9701a88453b48b (patch)
tree06fb9b2e79d8056b1027ac7963472cf58a90126e
parentee9d4eefbaf72ca113002216f95c61f34fe6e1bf (diff)
parent5f7556cd39217a3a7f27de18d3b7366dfe591f23 (diff)
downloadrust-1a6c18d6608933240d964a1d1a9701a88453b48b.tar.gz
rust-1a6c18d6608933240d964a1d1a9701a88453b48b.zip
rollup merge of #24665: sw17ch/document-complete-slice-syntax
The documentation doesn't appear to describe the `&foo[..]` syntax.

I tried looking in `primitive-types.html#slices` and `std/primitive.slice.html`.

There's an example of partially slicing an array in trpl and a mention of `&foo[..]` in [the standard library documentation](https://doc.rust-lang.org/std/primitive.slice.html), but neither place, from what I can see, actually describes the behavior of `&foo[..]`.

+r? @steveklabnik
-rw-r--r--src/doc/trpl/primitive-types.md1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/doc/trpl/primitive-types.md b/src/doc/trpl/primitive-types.md
index 811080cd509..e4af03869d1 100644
--- a/src/doc/trpl/primitive-types.md
+++ b/src/doc/trpl/primitive-types.md
@@ -168,6 +168,7 @@ like arrays:
 ```rust
 let a = [0, 1, 2, 3, 4];
 let middle = &a[1..4]; // A slice of a: just the elements 1, 2, and 3
+let complete = &a[..]; // A slice containing all of the elements in a
 ```
 
 Slices have type `&[T]`. We’ll talk about that `T` when we cover