rust/src/test/ui/feature-gates/feature-gate-slice-patterns.rs
2018-12-25 21:08:33 -07:00

17 lines
790 B
Rust

// Test that slice pattern syntax with `..` is gated by `slice_patterns` feature gate
fn main() {
let x = [1, 2, 3, 4, 5];
match x {
[1, 2, ..] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
[1, .., 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
[.., 4, 5] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
}
let x = [ 1, 2, 3, 4, 5 ];
match x {
[ xs.., 4, 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
[ 1, xs.., 5 ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
[ 1, 2, xs.. ] => {} //~ ERROR syntax for subslices in slice patterns is not yet stabilized
}
}