Skip to content

Commit 4ed108c

Browse files
committed
---
yaml --- r: 35899 b: refs/heads/try2 c: 544d36b h: refs/heads/master i: 35897: d186bb9 35895: af9cc11 v: v3
1 parent e8b8238 commit 4ed108c

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
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: 533cce80504b5cc6d29b1d2d3e0dfc0d77095702
8+
refs/heads/try2: 544d36bc4d186f54e887ea427c377d806c2e73fe
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: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2186,7 +2186,7 @@ match_pat : pat [ ".." pat ] ? [ "if" expr ] ;
21862186

21872187
A `match` expression branches on a *pattern*. The exact form of matching that
21882188
occurs depends on the pattern. Patterns consist of some combination of
2189-
literals, destructured enum constructors, records and tuples, variable binding
2189+
literals, destructured enum constructors, structures, records and tuples, variable binding
21902190
specifications, wildcards (`*`), and placeholders (`_`). A `match` expression has a *head
21912191
expression*, which is the value to compare to the patterns. The type of the
21922192
patterns must equal the type of the head expression.
@@ -2196,19 +2196,19 @@ In a pattern whose head expression has an `enum` type, a placeholder (`_`) stand
21962196
variant. For example:
21972197

21982198
~~~~
2199-
enum list<X> { nil, cons(X, @list<X>) }
2199+
enum List<X> { Nil, Cons(X, @List<X>) }
22002200
2201-
let x: list<int> = cons(10, @cons(11, @nil));
2201+
let x: List<int> = Cons(10, @Cons(11, @Nil));
22022202
22032203
match x {
2204-
cons(_, @nil) => fail ~"singleton list",
2205-
cons(*) => return,
2206-
nil => fail ~"empty list"
2204+
Cons(_, @Nil) => fail ~"singleton list",
2205+
Cons(*) => return,
2206+
Nil => fail ~"empty list"
22072207
}
22082208
~~~~
22092209

2210-
The first pattern matches lists constructed by applying `cons` to any head value, and a
2211-
tail value of `@nil`. The second pattern matches `any` list constructed with `cons`,
2210+
The first pattern matches lists constructed by applying `Cons` to any head value, and a
2211+
tail value of `@Nil`. The second pattern matches _any_ list constructed with `Cons`,
22122212
ignoring the values of its arguments. The difference between `_` and `*` is that the pattern `C(_)` is only type-correct if
22132213
`C` has exactly one argument, while the pattern `C(*)` is type-correct for any enum variant `C`, regardless of how many arguments `C` has.
22142214

@@ -2225,18 +2225,18 @@ An example of an `match` expression:
22252225
# fn process_pair(a: int, b: int) { }
22262226
# fn process_ten() { }
22272227
2228-
enum list<X> { nil, cons(X, @list<X>) }
2228+
enum List<X> { Nil, Cons(X, @List<X>) }
22292229
2230-
let x: list<int> = cons(10, @cons(11, @nil));
2230+
let x: List<int> = Cons(10, @Cons(11, @Nil));
22312231
22322232
match x {
2233-
cons(a, @cons(b, _)) => {
2233+
Cons(a, @Cons(b, _)) => {
22342234
process_pair(a,b);
22352235
}
2236-
cons(10, _) => {
2236+
Cons(10, _) => {
22372237
process_ten();
22382238
}
2239-
nil => {
2239+
Nil => {
22402240
return;
22412241
}
22422242
_ => {
@@ -2245,7 +2245,7 @@ match x {
22452245
}
22462246
~~~~
22472247

2248-
Records can also be pattern-matched and their fields bound to variables.
2248+
Records and structures can also be pattern-matched and their fields bound to variables.
22492249
When matching fields of a record, the fields being matched are specified
22502250
first, then a placeholder (`_`) represents the remaining fields.
22512251

0 commit comments

Comments
 (0)