diff options
| author | bors <bors@rust-lang.org> | 2016-06-08 19:30:33 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-06-08 19:30:33 -0700 |
| commit | bb4b3fb7f97924919f072ec9a360bdf943218dbf (patch) | |
| tree | 3765d3082b94546c8ea1b23ae75e12aa7b43924b /src/doc | |
| parent | 34505e22289d3b2416ab0922131e8526d0d5cc0b (diff) | |
| parent | 2de6ea7a35fb53ce5e4a7e5541a2adf425b7da23 (diff) | |
| download | rust-bb4b3fb7f97924919f072ec9a360bdf943218dbf.tar.gz rust-bb4b3fb7f97924919f072ec9a360bdf943218dbf.zip | |
Auto merge of #32202 - arielb1:slice-patterns, r=nikomatsakis
Implement RFC495 semantics for slice patterns non-MIR translation is still not supported for these and will happily ICE. This is a [breaking-change] for many uses of slice_patterns. [RFC 495 text](https://github.com/rust-lang/rfcs/blob/master/text/0495-array-pattern-changes.md)
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/book/slice-patterns.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/doc/book/slice-patterns.md b/src/doc/book/slice-patterns.md index de165b70fc4..fcedf0c994f 100644 --- a/src/doc/book/slice-patterns.md +++ b/src/doc/book/slice-patterns.md @@ -10,7 +10,7 @@ fn main() { let v = vec!["match_this", "1"]; match &v[..] { - ["match_this", second] => println!("The second element is {}", second), + &["match_this", second] => println!("The second element is {}", second), _ => {}, } } @@ -26,8 +26,8 @@ slice will be bound to that name. For example: fn is_symmetric(list: &[u32]) -> bool { match list { - [] | [_] => true, - [x, inside.., y] if x == y => is_symmetric(inside), + &[] | &[_] => true, + &[x, ref inside.., y] if x == y => is_symmetric(inside), _ => false } } |
