]> git.proxmox.com Git - rustc.git/blob - src/test/compile-fail/pat-slice-old-style.rs
54028ffa63ffc0f87bb2f27cd8bc1b887e713d93
[rustc.git] / src / test / compile-fail / pat-slice-old-style.rs
1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 #![feature(slice_patterns)]
12
13 // NB: this test was introduced in #23121 and will have to change when default match binding modes
14 // stabilizes.
15
16 fn slice_pat(x: &[u8]) {
17 // OLD!
18 match x {
19 [a, b..] => {},
20 //~^ ERROR expected an array or slice, found `&[u8]`
21 //~| HELP the semantics of slice patterns changed recently; see issue #23121
22 _ => panic!(),
23 }
24 }
25
26 fn main() {
27 slice_pat("foo".as_bytes());
28 }