From bcdbe942e108e47ffa712fa44ad9b251c53c105b Mon Sep 17 00:00:00 2001 From: Andrew Cann Date: Tue, 29 Nov 2016 15:10:26 +0800 Subject: Make is_useful handle empty types properly --- .../compile-fail/match-byte-array-patterns-2.rs | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/test/compile-fail/match-byte-array-patterns-2.rs (limited to 'src/test/compile-fail/match-byte-array-patterns-2.rs') diff --git a/src/test/compile-fail/match-byte-array-patterns-2.rs b/src/test/compile-fail/match-byte-array-patterns-2.rs new file mode 100644 index 00000000000..ad7e931a0ec --- /dev/null +++ b/src/test/compile-fail/match-byte-array-patterns-2.rs @@ -0,0 +1,26 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(advanced_slice_patterns, slice_patterns)] + +fn main() { + let buf = &[0, 1, 2, 3]; + + match buf { //~ ERROR non-exhaustive + b"AAAA" => {} + } + + let buf: &[u8] = buf; + + match buf { //~ ERROR non-exhaustive + b"AAAA" => {} + } +} + -- cgit 1.4.1-3-g733a5