]> git.lizzy.rs Git - rust.git/blobdiff - src/test/ui/pattern/slice-pattern-const.rs
Add a few more tests of edge cases
[rust.git] / src / test / ui / pattern / slice-pattern-const.rs
index d353f6cddbd0d05e8d27eda568c0daaf18b7a164..e2589ddf81c64a74a39ce7781108037277218e17 100644 (file)
@@ -21,4 +21,27 @@ fn main() {
         MAGIC_TEST => (), // this should warn
         _ => (),
     }
+    const FOO: [u8; 1] = [4];
+    match [99] {
+        [0x00] => (),
+        [4] => (),
+        FOO => (), // this should warn
+        _ => (),
+    }
+    const BAR: &[u8; 1] = &[4];
+    match &[99] {
+        [0x00] => (),
+        [4] => (),
+        BAR => (), // this should warn
+        b"a" => (),
+        _ => (),
+    }
+
+    const BOO: &[u8; 0] = &[];
+    match &[] {
+        [] => (),
+        BOO => (), // this should warn
+        b"" => (),
+        _ => (),
+    }
 }