about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/suggestions/pattern-struct-with-slice-vec-field.rs13
-rw-r--r--src/test/ui/suggestions/pattern-struct-with-slice-vec-field.stderr9
2 files changed, 22 insertions, 0 deletions
diff --git a/src/test/ui/suggestions/pattern-struct-with-slice-vec-field.rs b/src/test/ui/suggestions/pattern-struct-with-slice-vec-field.rs
new file mode 100644
index 00000000000..1a9fc2f0050
--- /dev/null
+++ b/src/test/ui/suggestions/pattern-struct-with-slice-vec-field.rs
@@ -0,0 +1,13 @@
+struct Foo {
+    v: Vec<u32>,
+}
+
+fn f(foo: &Foo) {
+    match foo {
+        Foo { v: [1, 2] } => {}
+        //~^ ERROR expected an array or slice, found `Vec<u32>
+        _ => {}
+    }
+}
+
+fn main() {}
diff --git a/src/test/ui/suggestions/pattern-struct-with-slice-vec-field.stderr b/src/test/ui/suggestions/pattern-struct-with-slice-vec-field.stderr
new file mode 100644
index 00000000000..cb408d38fd2
--- /dev/null
+++ b/src/test/ui/suggestions/pattern-struct-with-slice-vec-field.stderr
@@ -0,0 +1,9 @@
+error[E0529]: expected an array or slice, found `Vec<u32>`
+  --> $DIR/pattern-struct-with-slice-vec-field.rs:7:18
+   |
+LL |         Foo { v: [1, 2] } => {}
+   |                  ^^^^^^ pattern cannot match with input type `Vec<u32>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0529`.