diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-12-30 01:53:22 +0100 |
|---|---|---|
| committer | Mazdak Farrokhzad <twingoow@gmail.com> | 2020-01-18 19:33:47 +0100 |
| commit | 120e98c3c7d28b1667576d0fa32fa94751968699 (patch) | |
| tree | 1353fc71d086b7c5fc6f138d27de19de4d027d9a /src/doc | |
| parent | e3c2f8fc57e718f4ba1d7f52405eb2c1cb434559 (diff) | |
| download | rust-120e98c3c7d28b1667576d0fa32fa94751968699.tar.gz rust-120e98c3c7d28b1667576d0fa32fa94751968699.zip | |
slice_patterns: remove from unstable book
Diffstat (limited to 'src/doc')
| -rw-r--r-- | src/doc/unstable-book/src/language-features/slice-patterns.md | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/doc/unstable-book/src/language-features/slice-patterns.md b/src/doc/unstable-book/src/language-features/slice-patterns.md deleted file mode 100644 index cdb74495884..00000000000 --- a/src/doc/unstable-book/src/language-features/slice-patterns.md +++ /dev/null @@ -1,32 +0,0 @@ -# `slice_patterns` - -The tracking issue for this feature is: [#62254] - -[#62254]: https://github.com/rust-lang/rust/issues/62254 - ------------------------- - -The `slice_patterns` feature gate lets you use `..` to indicate any number of -elements inside a pattern matching a slice. This wildcard can only be used once -for a given array. If there's an pattern before the `..`, the subslice will be -matched against that pattern. For example: - -```rust -#![feature(slice_patterns)] - -fn is_symmetric(list: &[u32]) -> bool { - match list { - &[] | &[_] => true, - &[x, ref inside @ .., y] if x == y => is_symmetric(inside), - &[..] => false, - } -} - -fn main() { - let sym = &[0, 1, 4, 2, 4, 1, 0]; - assert!(is_symmetric(sym)); - - let not_sym = &[0, 1, 7, 2, 4, 1, 0]; - assert!(!is_symmetric(not_sym)); -} -``` |
