about summary refs log tree commit diff
path: root/src/test/compile-fail/match-byte-array-patterns-2.rs
diff options
context:
space:
mode:
authorAndrew Cann <shum@canndrew.org>2016-11-29 15:10:26 +0800
committerAndrew Cann <shum@canndrew.org>2017-01-03 15:31:46 +0800
commitbcdbe942e108e47ffa712fa44ad9b251c53c105b (patch)
tree8afed02b3f00112fe4aed144a0209eacecdf1320 /src/test/compile-fail/match-byte-array-patterns-2.rs
parent9ad20442e8af42815fde41c03188764ac516cf18 (diff)
downloadrust-bcdbe942e108e47ffa712fa44ad9b251c53c105b.tar.gz
rust-bcdbe942e108e47ffa712fa44ad9b251c53c105b.zip
Make is_useful handle empty types properly
Diffstat (limited to 'src/test/compile-fail/match-byte-array-patterns-2.rs')
-rw-r--r--src/test/compile-fail/match-byte-array-patterns-2.rs26
1 files changed, 26 insertions, 0 deletions
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 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, 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" => {}
+    }
+}
+