Skip to content

Commit 1b993f8

Browse files
committed
---
yaml --- r: 35911 b: refs/heads/try2 c: 13ea161 h: refs/heads/master i: 35909: d219bf0 35907: 20a0ee5 35903: 79dc866 v: v3
1 parent 58f2957 commit 1b993f8

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
55
refs/heads/try: d324a424d8f84b1eb049b12cf34182bda91b0024
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: d81d4f1f3c94716c6dcafaf88d860aaa5d3598ca
8+
refs/heads/try2: 13ea16152d34368c44da05960135ba58ec622cda
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
1010
refs/heads/dist-snap: 22efa39382d41b084fde1719df7ae8ce5697d8c9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try2/doc/rust.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -908,10 +908,10 @@ declared, in an angle-bracket-enclosed, comma-separated list following
908908
the function name.
909909

910910
~~~~ {.xfail-test}
911-
fn iter<T>(seq: ~[T], f: fn(T)) {
911+
fn iter<T>(seq: &[T], f: fn(T)) {
912912
for seq.each |elt| { f(elt); }
913913
}
914-
fn map<T, U>(seq: ~[T], f: fn(T) -> U) -> ~[U] {
914+
fn map<T, U>(seq: &[T], f: fn(T) -> U) -> ~[U] {
915915
let mut acc = ~[];
916916
for seq.each |elt| { acc.push(f(elt)); }
917917
acc
@@ -1608,9 +1608,9 @@ indicate that the elements of the resulting vector may be mutated.
16081608
When no mutability is specified, the vector is immutable.
16091609

16101610
~~~~
1611-
~[1, 2, 3, 4];
1612-
~["a", "b", "c", "d"];
1613-
~[mut 0u8, 0u8, 0u8, 0u8];
1611+
[1, 2, 3, 4];
1612+
["a", "b", "c", "d"];
1613+
[mut 0u8, 0u8, 0u8, 0u8];
16141614
~~~~
16151615

16161616
### Index expressions
@@ -1631,9 +1631,9 @@ task in a _failing state_.
16311631
~~~~
16321632
# do task::spawn_unlinked {
16331633
1634-
(~[1, 2, 3, 4])[0];
1635-
(~[mut 'x', 'y'])[1] = 'z';
1636-
(~["a", "b"])[10]; // fails
1634+
([1, 2, 3, 4])[0];
1635+
([mut 'x', 'y'])[1] = 'z';
1636+
(["a", "b"])[10]; // fails
16371637
16381638
# }
16391639
~~~~
@@ -1770,10 +1770,10 @@ Any other cast is unsupported and will fail to compile.
17701770
An example of an `as` expression:
17711771

17721772
~~~~
1773-
# fn sum(v: ~[float]) -> float { 0.0 }
1774-
# fn len(v: ~[float]) -> int { 0 }
1773+
# fn sum(v: &[float]) -> float { 0.0 }
1774+
# fn len(v: &[float]) -> int { 0 }
17751775
1776-
fn avg(v: ~[float]) -> float {
1776+
fn avg(v: &[float]) -> float {
17771777
let sum: float = sum(v);
17781778
let sz: float = len(v) as float;
17791779
return sum / sz;
@@ -1800,8 +1800,8 @@ No allocation or destruction is entailed.
18001800
An example of three different move expressions:
18011801

18021802
~~~~~~~~
1803-
# let mut x = ~[mut 0];
1804-
# let a = ~[mut 0];
1803+
# let mut x = &[mut 0];
1804+
# let a = &[mut 0];
18051805
# let b = 0;
18061806
# let y = {mut z: 0};
18071807
# let c = 0;
@@ -1827,8 +1827,8 @@ No allocation or destruction is entailed.
18271827
An example of three different swap expressions:
18281828

18291829
~~~~~~~~
1830-
# let mut x = ~[mut 0];
1831-
# let mut a = ~[mut 0];
1830+
# let mut x = &[mut 0];
1831+
# let mut a = &[mut 0];
18321832
# let i = 0;
18331833
# let y = {mut z: 0};
18341834
# let b = {mut c: 0};
@@ -1929,11 +1929,11 @@ the unary copy operator is typically only used to cause an argument to a functio
19291929
An example of a copy expression:
19301930

19311931
~~~~
1932-
fn mutate(vec: ~[mut int]) {
1932+
fn mutate(vec: &[mut int]) {
19331933
vec[0] = 10;
19341934
}
19351935
1936-
let v = ~[mut 1,2,3];
1936+
let v = &[mut 1,2,3];
19371937
19381938
mutate(copy v); // Pass a copy
19391939
@@ -2716,7 +2716,7 @@ In this example, the trait `Printable` occurs as a type in both the type signatu
27162716
Within the body of an item that has type parameter declarations, the names of its type parameters are types:
27172717

27182718
~~~~~~~
2719-
fn map<A: Copy, B: Copy>(f: fn(A) -> B, xs: ~[A]) -> ~[B] {
2719+
fn map<A: Copy, B: Copy>(f: fn(A) -> B, xs: &[A]) -> ~[B] {
27202720
if xs.len() == 0 { return ~[]; }
27212721
let first: B = f(xs[0]);
27222722
let rest: ~[B] = map(f, xs.slice(1, xs.len()));

0 commit comments

Comments
 (0)