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 {
2424 }
2525}
2626
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+
2737fn main() {}
Original file line number Diff line number Diff line change @@ -24,4 +24,14 @@ fn bar(o: Option<Vec<i32>>) -> i32 {
2424 }
2525}
2626
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+
2737fn main ( ) { }
Original file line number Diff line number Diff line change 1616LL | Some([a, b]) => a + b,
1717 | ^^^^^^ pattern cannot match with input type `Vec<i32>`
1818
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
2029
2130For more information about this error, try `rustc --explain E0529`.
You can’t perform that action at this time.
0 commit comments