Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #72534 - chrissimpkins:fix-72373, r=estebank
Improve missing `@` in slice binding pattern diagnostics Closes #72373 Includes a new suggestion with `Applicability::MaybeIncorrect` confidence level. Before: ``` --> src/main.rs:5:19 | 5 | [h, ref ts..] => foo(c, n - h) + foo(ts, n), | -^ | | | expected one of `,`, `@`, `]`, or `|` | help: missing `,` error[E0308]: mismatched types --> src/main.rs:5:46 | 5 | [h, ref ts..] => foo(c, n - h) + foo(ts, n), | ^^ expected slice `[u32]`, found `u32` | = note: expected reference `&[u32]` found reference `&u32` error: aborting due to 2 previous errors ``` After: ``` error: expected one of `,`, `@`, `]`, or `|`, found `..` --> src/main.rs:5:20 | 5 | [h, ref ts..] => foo(c, n - h) + foo(ts, n), | ^^ expected one of `,`, `@`, `]`, or `|` | help: if you meant to bind the contents of the rest of the array pattern into `ts`, use `@` | 5 | [h, ref ts @ ..] => foo(c, n - h) + foo(ts, n), | ^ error: aborting due to previous error ``` r? @estebank
- Loading branch information