Skip to content

Commit 097f8dd

Browse files
committed
---
yaml --- r: 151188 b: refs/heads/try2 c: b7dba33 h: refs/heads/master v: v3
1 parent 43254e8 commit 097f8dd

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
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: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 53711461070ec8ad0d71c4bcdb35de3120e07ec5
8+
refs/heads/try2: b7dba3300e48e87e321dcfcc8db09dd3e69e48ba
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/rust.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ Two examples of paths with type arguments:
471471
# fn f() {
472472
# fn id<T>(t: T) -> T { t }
473473
type T = HashMap<int,~str>; // Type arguments used in a type expression
474-
let x = id::<int>(10); // Type arguments used in a call expression
474+
let x = id::<int>(10); // Type arguments used in a call expression
475475
# }
476476
~~~~
477477

branches/try2/src/doc/tutorial.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -982,7 +982,8 @@ The obvious approach is to define `Cons` as containing an element in the list
982982
along with the next `List` node. However, this will generate a compiler error.
983983

984984
~~~ {.ignore}
985-
// error: illegal recursive enum type; wrap the inner value in a box to make it representable
985+
// error: illegal recursive enum type; wrap the inner value in a box to make it
986+
// representable
986987
enum List {
987988
Cons(u32, List), // an element (`u32`) and the next node in the list
988989
Nil
@@ -1054,10 +1055,10 @@ immutable, the whole list is immutable. The memory allocation itself is the
10541055
box, while the owner holds onto a pointer to it:
10551056

10561057
~~~ {.notrust}
1057-
List box List box List box List box
1058-
+--------------+ +--------------+ +--------------+ +--------------+
1059-
list -> | Cons | 1 | ~ | -> | Cons | 2 | ~ | -> | Cons | 3 | ~ | -> | Nil |
1060-
+--------------+ +--------------+ +--------------+ +--------------+
1058+
List box List box List box List box
1059+
+--------------+ +--------------+ +--------------+ +----------+
1060+
list -> | Cons | 1 | ~ | -> | Cons | 2 | ~ | -> | Cons | 3 | ~ | -> | Nil |
1061+
+--------------+ +--------------+ +--------------+ +----------+
10611062
~~~
10621063

10631064
> *Note:* the above diagram shows the logical contents of the enum. The actual
@@ -1197,7 +1198,8 @@ fn eq(xs: &List, ys: &List) -> bool {
11971198
// If we have reached the end of both lists, they are equal.
11981199
(&Nil, &Nil) => true,
11991200
// If the current element in both lists is equal, keep going.
1200-
(&Cons(x, ~ref next_xs), &Cons(y, ~ref next_ys)) if x == y => eq(next_xs, next_ys),
1201+
(&Cons(x, ~ref next_xs), &Cons(y, ~ref next_ys))
1202+
if x == y => eq(next_xs, next_ys),
12011203
// If the current elements are not equal, the lists are not equal.
12021204
_ => false
12031205
}
@@ -1256,7 +1258,7 @@ Using the generic `List<T>` works much like before, thanks to type inference:
12561258
# Cons(value, ~xs)
12571259
# }
12581260
let mut xs = Nil; // Unknown type! This is a `List<T>`, but `T` can be anything.
1259-
xs = prepend(xs, 10); // The compiler infers the type of `xs` as `List<int>` from this.
1261+
xs = prepend(xs, 10); // Here the compiler infers `xs`'s type as `List<int>`.
12601262
xs = prepend(xs, 15);
12611263
xs = prepend(xs, 20);
12621264
~~~
@@ -1303,7 +1305,8 @@ fn eq<T: Eq>(xs: &List<T>, ys: &List<T>) -> bool {
13031305
// If we have reached the end of both lists, they are equal.
13041306
(&Nil, &Nil) => true,
13051307
// If the current element in both lists is equal, keep going.
1306-
(&Cons(ref x, ~ref next_xs), &Cons(ref y, ~ref next_ys)) if x == y => eq(next_xs, next_ys),
1308+
(&Cons(ref x, ~ref next_xs), &Cons(ref y, ~ref next_ys))
1309+
if x == y => eq(next_xs, next_ys),
13071310
// If the current elements are not equal, the lists are not equal.
13081311
_ => false
13091312
}
@@ -1331,7 +1334,8 @@ impl<T: Eq> Eq for List<T> {
13311334
// If we have reached the end of both lists, they are equal.
13321335
(&Nil, &Nil) => true,
13331336
// If the current element in both lists is equal, keep going.
1334-
(&Cons(ref x, ~ref next_xs), &Cons(ref y, ~ref next_ys)) if x == y => next_xs == next_ys,
1337+
(&Cons(ref x, ~ref next_xs), &Cons(ref y, ~ref next_ys))
1338+
if x == y => next_xs == next_ys,
13351339
// If the current elements are not equal, the lists are not equal.
13361340
_ => false
13371341
}

0 commit comments

Comments
 (0)