Skip to content

Commit 1a6c18d

Browse files
committed
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
2 parents ee9d4ee + 5f7556c commit 1a6c18d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/doc/trpl/primitive-types.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ like arrays:
168168
```rust
169169
let a = [0, 1, 2, 3, 4];
170170
let middle = &a[1..4]; // A slice of a: just the elements 1, 2, and 3
171+
let complete = &a[..]; // A slice containing all of the elements in a
171172
```
172173

173174
Slices have type `&[T]`. We’ll talk about that `T` when we cover

0 commit comments

Comments
 (0)