Skip to content

Commit 9dc5d95

Browse files
committed
---
yaml --- r: 136637 b: refs/heads/dist-snap c: 64813d3 h: refs/heads/master i: 136635: 99441ad v: v3
1 parent 27c9d61 commit 9dc5d95

File tree

2 files changed

+10
-17
lines changed

2 files changed

+10
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: 189b7332968972f34cdbbbd9b62d97ababf53059
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: c94d479a90ab4e99926ac218d1b2329056c7e04b
9+
refs/heads/dist-snap: 64813d33d825cbd155ef237accc9fe8c8b670ed2
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/doc/reference.md

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2810,9 +2810,8 @@ array_expr : '[' "mut" ? vec_elems? ']' ;
28102810
array_elems : [expr [',' expr]*] | [expr ',' ".." expr] ;
28112811
```
28122812

2813-
An [array](#vector,-array,-and-slice-types) _expression_ is written by
2814-
enclosing zero or more comma-separated expressions of uniform type in square
2815-
brackets.
2813+
An [array](#array,-and-slice-types) _expression_ is written by enclosing zero
2814+
or more comma-separated expressions of uniform type in square brackets.
28162815

28172816
In the `[expr ',' ".." expr]` form, the expression after the `".."` must be a
28182817
constant expression that can be evaluated at compile time, such as a
@@ -2831,7 +2830,7 @@ constant expression that can be evaluated at compile time, such as a
28312830
idx_expr : expr '[' expr ']' ;
28322831
```
28332832

2834-
[Array](#vector,-array,-and-slice-types)-typed expressions can be indexed by
2833+
[Array](#array,-and-slice-types)-typed expressions can be indexed by
28352834
writing a square-bracket-enclosed expression (the index) after them. When the
28362835
array is mutable, the resulting [lvalue](#lvalues,-rvalues-and-temporaries) can
28372836
be assigned to.
@@ -3551,23 +3550,17 @@ let (a, b) = p;
35513550
assert!(b != "world");
35523551
```
35533552

3554-
### Vector, Array, and Slice types
3553+
### Array, and Slice types
35553554

3556-
Rust has three different types for a list of items:
3555+
Rust has two different types for a list of items:
35573556

3558-
* `Vec<T>`, a 'vector'
35593557
* `[T ..N]`, an 'array'
35603558
* `&[T]`, a 'slice'.
35613559

3562-
A vector is a heap-allocated list of `T`. A vector has ownership over the data
3563-
inside of it. It is also able to grow and change in size. It's important to
3564-
note that `Vec<T>` is a library type, it's not actually part of the core
3565-
language.
3566-
35673560
An array has a fixed size, and can be allocated on either the stack or the
35683561
heap.
35693562

3570-
A slice is a 'view' into a vector or array. It doesn't own the data it points
3563+
A slice is a 'view' into an array. It doesn't own the data it points
35713564
to, it borrows it.
35723565

35733566
An example of each kind:
@@ -3581,8 +3574,8 @@ let s: &[int] = vec.as_slice();
35813574
As you can see, the `vec!` macro allows you to create a `Vec<T>` easily. The
35823575
`vec!` macro is also part of the standard library, rather than the language.
35833576

3584-
All in-bounds elements of vectors, arrays, and slices are always initialized,
3585-
and access to a vector, array, or slice is always bounds-checked.
3577+
All in-bounds elements of arrays, and slices are always initialized, and access
3578+
to an array or slice is always bounds-checked.
35863579

35873580
### Structure types
35883581

@@ -3644,7 +3637,7 @@ enclosing `enum` or `struct` type itself. Such recursion has restrictions:
36443637

36453638
* Recursive types must include a nominal type in the recursion
36463639
(not mere [type definitions](#type-definitions),
3647-
or other structural types such as [arrays](#vector,-array,-and-slice-types) or [tuples](#tuple-types)).
3640+
or other structural types such as [arrays](#array,-and-slice-types) or [tuples](#tuple-types)).
36483641
* A recursive `enum` item must have at least one non-recursive constructor
36493642
(in order to give the recursion a basis case).
36503643
* The size of a recursive type must be finite;

0 commit comments

Comments
 (0)