fix an invalid error for a suggestion to add a slice in pattern-matching
This commit is contained in:
parent
e7575f9670
commit
a59cc5774b
3 changed files with 69 additions and 46 deletions
|
|
@ -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() {}
|
||||
|
|
@ -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`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue