]> git.lizzy.rs Git - rust.git/blob - tests/ui/suggestions/pattern-struct-with-slice-vec-field.rs
Rollup merge of #106919 - compiler-errors:underscore-typo-in-field-pat, r=jackh726
[rust.git] / tests / ui / suggestions / pattern-struct-with-slice-vec-field.rs
1 use std::ops::Deref;
2
3 struct Foo {
4     v: Vec<u32>,
5 }
6
7 struct Bar {
8     v: Vec<u32>,
9 }
10
11 impl Deref for Bar {
12     type Target = Vec<u32>;
13
14     fn deref(&self) -> &Self::Target {
15         &self.v
16     }
17 }
18
19 fn f(foo: &Foo) {
20     match foo {
21         Foo { v: [1, 2] } => {}
22         //~^ ERROR expected an array or slice, found `Vec<u32>
23         _ => {}
24     }
25 }
26
27 fn bar(bar: &Bar) {
28     match bar {
29         Bar { v: [1, 2] } => {}
30         //~^ ERROR expected an array or slice, found `Vec<u32>
31         _ => {}
32     }
33 }
34
35 fn main() {}