diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2024-02-03 01:32:01 +0100 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2024-02-04 22:16:21 +0100 |
| commit | 285d8c225d05966040f6a69bfdea83165b54483f (patch) | |
| tree | 18dc88664286add9ebb16ac5f3108c7c7748b079 /tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.rs | |
| parent | 4e3eed48926b8b70eee8beb082e37ffa4985c0ed (diff) | |
| download | rust-285d8c225d05966040f6a69bfdea83165b54483f.tar.gz rust-285d8c225d05966040f6a69bfdea83165b54483f.zip | |
Suggest `[tail @ ..]` on `[..tail]` and `[...tail]` where `tail` is unresolved
Diffstat (limited to 'tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.rs')
| -rw-r--r-- | tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.rs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.rs b/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.rs index a619fcafc86..1eba7aeb4d6 100644 --- a/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.rs +++ b/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.rs @@ -1,9 +1,23 @@ fn main() { match &[1, 2, 3][..] { - [1, rest..] => println!("{rest:?}"), + [1, rest..] => println!("{rest}"), //~^ ERROR cannot find value `rest` in this scope //~| ERROR cannot find value `rest` in this scope //~| ERROR `X..` patterns in slices are experimental _ => {} } + match &[4, 5, 6][..] { + [] => {} + [_, ..tail] => println!("{tail}"), + //~^ ERROR cannot find value `tail` in this scope + //~| ERROR cannot find value `tail` in this scope + //~| ERROR exclusive range pattern syntax is experimental + } + match &[7, 8, 9][..] { + [] => {} + [_, ...tail] => println!("{tail}"), + //~^ ERROR cannot find value `tail` in this scope + //~| ERROR cannot find value `tail` in this scope + //~| ERROR range-to patterns with `...` are not allowed + } } |
