rust/src/test/ui/pattern/usefulness/65413-constants-and-slices-exhaustiveness.rs

16 lines
306 B
Rust
Raw Normal View History

2019-11-17 16:25:51 -06:00
#![feature(slice_patterns)]
#![deny(unreachable_patterns)]
const C0: &'static [u8] = b"\x00";
fn main() {
let x: &[u8] = &[0];
match x {
&[] => {}
&[1..=255] => {}
// this shouldn't be unreachable
C0 => {} //~ unreachable pattern
&[_, _, ..] => {}
}
}