File tree 2 files changed +43
-0
lines changed
2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ pub struct Struct {
2
+ a : Vec < Struct > ,
3
+ }
4
+
5
+ impl Struct {
6
+ pub fn test ( & self ) {
7
+ if let [ Struct { a : [ ] } ] = & self . a {
8
+ //~^ ERROR expected an array or slice
9
+ //~| ERROR expected an array or slice
10
+ println ! ( "matches!" )
11
+ }
12
+
13
+ if let [ Struct { a : [ ] } ] = & self . a [ ..] {
14
+ //~^ ERROR expected an array or slice
15
+ println ! ( "matches!" )
16
+ }
17
+ }
18
+ }
19
+
20
+ fn main ( ) { }
Original file line number Diff line number Diff line change
1
+ error[E0529]: expected an array or slice, found `Vec<Struct>`
2
+ --> $DIR/issue120605.rs:7:16
3
+ |
4
+ LL | if let [Struct { a: [] }] = &self.a {
5
+ | ^^^^^^^^^^^^^^^^^^ ------- help: consider slicing here: `&self.a[..]`
6
+ | |
7
+ | pattern cannot match with input type `Vec<Struct>`
8
+
9
+ error[E0529]: expected an array or slice, found `Vec<Struct>`
10
+ --> $DIR/issue120605.rs:7:29
11
+ |
12
+ LL | if let [Struct { a: [] }] = &self.a {
13
+ | ^^ pattern cannot match with input type `Vec<Struct>`
14
+
15
+ error[E0529]: expected an array or slice, found `Vec<Struct>`
16
+ --> $DIR/issue120605.rs:13:29
17
+ |
18
+ LL | if let [Struct { a: [] }] = &self.a[..] {
19
+ | ^^ pattern cannot match with input type `Vec<Struct>`
20
+
21
+ error: aborting due to 3 previous errors
22
+
23
+ For more information about this error, try `rustc --explain E0529`.
You can’t perform that action at this time.
0 commit comments