Adjust an expr span to account for macros

This commit is contained in:
Michael Goulet 2022-07-29 06:02:11 +00:00
parent 9de7474830
commit dec29b1582
5 changed files with 22 additions and 3 deletions

View file

@ -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
}

View file

@ -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
}

View file

@ -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`.