diff options
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/suggestions/pattern-slice-vec.fixed | 4 | ||||
| -rw-r--r-- | src/test/ui/suggestions/pattern-slice-vec.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/suggestions/pattern-slice-vec.stderr | 10 |
3 files changed, 17 insertions, 1 deletions
diff --git a/src/test/ui/suggestions/pattern-slice-vec.fixed b/src/test/ui/suggestions/pattern-slice-vec.fixed index 447337c39c4..f8144641f3c 100644 --- a/src/test/ui/suggestions/pattern-slice-vec.fixed +++ b/src/test/ui/suggestions/pattern-slice-vec.fixed @@ -24,4 +24,8 @@ fn main() { //~^ ERROR: expected an array or slice _ => {} } + + let [..] = vec![1, 2, 3][..]; + //~^ ERROR: expected an array or slice + //~| HELP: consider slicing here } diff --git a/src/test/ui/suggestions/pattern-slice-vec.rs b/src/test/ui/suggestions/pattern-slice-vec.rs index 1153ca026bb..444687c8578 100644 --- a/src/test/ui/suggestions/pattern-slice-vec.rs +++ b/src/test/ui/suggestions/pattern-slice-vec.rs @@ -24,4 +24,8 @@ fn main() { //~^ ERROR: expected an array or slice _ => {} } + + let [..] = vec![1, 2, 3]; + //~^ ERROR: expected an array or slice + //~| HELP: consider slicing here } diff --git a/src/test/ui/suggestions/pattern-slice-vec.stderr b/src/test/ui/suggestions/pattern-slice-vec.stderr index 403a816ba11..f69e7de971a 100644 --- a/src/test/ui/suggestions/pattern-slice-vec.stderr +++ b/src/test/ui/suggestions/pattern-slice-vec.stderr @@ -31,6 +31,14 @@ LL | LL | [5] => {} | ^^^ pattern cannot match with input type `Vec<_>` -error: aborting due to 4 previous errors +error[E0529]: expected an array or slice, found `Vec<{integer}>` + --> $DIR/pattern-slice-vec.rs:28:9 + | +LL | let [..] = vec![1, 2, 3]; + | ^^^^ ------------- help: consider slicing here: `vec![1, 2, 3][..]` + | | + | pattern cannot match with input type `Vec<{integer}>` + +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0529`. |
