Skip to content

Commit 804073f

Browse files
committed
---
yaml --- r: 134143 b: refs/heads/master c: 64813d3 h: refs/heads/master i: 134141: 62c3613 134139: d2c51c6 134135: 6d5f9a0 134127: 746d38c 134111: f851d3c 134079: 14d794d 134015: 8f76639 133887: 8f61fd0 133631: 27967a1 133119: 1b0ce5b v: v3
1 parent df32759 commit 804073f

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
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: c94d479a90ab4e99926ac218d1b2329056c7e04b
2+
refs/heads/master: 64813d33d825cbd155ef237accc9fe8c8b670ed2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 437179ed8bf7f7672f84b19265df1ce569e70490
55
refs/heads/try: 777654cfccbfa39bc7f671d8e9629018ed8ca12d

trunk/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)