Skip to content

Commit 232fb2f

Browse files
committed
---
yaml --- r: 37180 b: refs/heads/try c: 544d36b h: refs/heads/master v: v3
1 parent fd3bb4e commit 232fb2f

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
@@ -2,7 +2,7 @@
22
refs/heads/master: 09bb07bed9166105ea961a42b5fff7739ae0d2e9
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: eb8fd119c65c67f3b1b8268cc7341c22d39b7b61
5-
refs/heads/try: 533cce80504b5cc6d29b1d2d3e0dfc0d77095702
5+
refs/heads/try: 544d36bc4d186f54e887ea427c377d806c2e73fe
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278

branches/try/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)