diff options
| author | Patrick Walton <pcwalton@mimiga.net> | 2014-09-06 15:23:55 -0700 |
|---|---|---|
| committer | Patrick Walton <pcwalton@mimiga.net> | 2014-09-08 16:12:13 -0700 |
| commit | eb678ff87f0cdbf523b26fe9255cff684b4091e5 (patch) | |
| tree | 9fb3745051a57fd5f73d6d50aabf07ce9d2f6ea4 /src/doc | |
| parent | 6f34760e4173dda94162502153fe4c5a2a96fc9d (diff) | |
librustc: Change the syntax of subslice matching to use postfix `..`
instead of prefix `..`.
This breaks code that looked like:
match foo {
[ first, ..middle, last ] => { ... }
}
Change this code to:
match foo {
[ first, middle.., last ] => { ... }
}
RFC #55.
Closes #16967.
[breaking-change]
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/rust.md | 2 | ||||
| -rw-r--r-- | src/doc/tutorial.md | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/doc/rust.md b/src/doc/rust.md index 3fd48d45324..af8020babf2 100644 --- a/src/doc/rust.md +++ b/src/doc/rust.md @@ -3300,7 +3300,7 @@ it will bind the corresponding slice to the variable. Example: fn is_symmetric(list: &[uint]) -> bool { match list { [] | [_] => true, - [x, ..inside, y] if x == y => is_symmetric(inside), + [x, inside.., y] if x == y => is_symmetric(inside), _ => false } } diff --git a/src/doc/tutorial.md b/src/doc/tutorial.md index 0db25c4090e..0e5a624b273 100644 --- a/src/doc/tutorial.md +++ b/src/doc/tutorial.md @@ -1707,7 +1707,7 @@ let score = match numbers { [] => 0, [a] => a * 10, [a, b] => a * 6 + b * 4, - [a, b, c, ..rest] => a * 5 + b * 3 + c * 2 + rest.len() as int + [a, b, c, rest..] => a * 5 + b * 3 + c * 2 + rest.len() as int }; ~~~~ |
