File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -24,4 +24,14 @@ fn bar(o: Option<Vec<i32>>) -> i32 {
24
24
}
25
25
}
26
26
27
+ fn baz(v: Vec<i32>) -> i32 {
28
+ match v[..] {
29
+ //~^ HELP: consider slicing here
30
+ [a, b] => a + b,
31
+ //~^ ERROR: expected an array or slice
32
+ //~| NOTE: pattern cannot match with input type
33
+ _ => 42,
34
+ }
35
+ }
36
+
27
37
fn main() {}
Original file line number Diff line number Diff line change @@ -24,4 +24,14 @@ fn bar(o: Option<Vec<i32>>) -> i32 {
24
24
}
25
25
}
26
26
27
+ fn baz ( v : Vec < i32 > ) -> i32 {
28
+ match v {
29
+ //~^ HELP: consider slicing here
30
+ [ a, b] => a + b,
31
+ //~^ ERROR: expected an array or slice
32
+ //~| NOTE: pattern cannot match with input type
33
+ _ => 42 ,
34
+ }
35
+ }
36
+
27
37
fn main ( ) { }
Original file line number Diff line number Diff line change 16
16
LL | Some([a, b]) => a + b,
17
17
| ^^^^^^ pattern cannot match with input type `Vec<i32>`
18
18
19
- error: aborting due to 2 previous errors
19
+ error[E0529]: expected an array or slice, found `Vec<i32>`
20
+ --> $DIR/issue-91328.rs:30:9
21
+ |
22
+ LL | match v {
23
+ | - help: consider slicing here: `v[..]`
24
+ LL |
25
+ LL | [a, b] => a + b,
26
+ | ^^^^^^ pattern cannot match with input type `Vec<i32>`
27
+
28
+ error: aborting due to 3 previous errors
20
29
21
30
For more information about this error, try `rustc --explain E0529`.
You can’t perform that action at this time.
0 commit comments