diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2024-07-06 03:07:46 +0000 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2024-07-12 03:02:57 +0000 |
| commit | 692bc344d55cf9d86c60b06c92a70684d013c89f (patch) | |
| tree | 4ab084f04f99c13c3a5e84aeb405867bc3319f96 /tests/ui/pattern | |
| parent | 5e311f933d844b6922256a0c0aa49b86159534f5 (diff) | |
| download | rust-692bc344d55cf9d86c60b06c92a70684d013c89f.tar.gz rust-692bc344d55cf9d86c60b06c92a70684d013c89f.zip | |
Make parse error suggestions verbose and fix spans
Go over all structured parser suggestions and make them verbose style. When suggesting to add or remove delimiters, turn them into multiple suggestion parts.
Diffstat (limited to 'tests/ui/pattern')
4 files changed, 32 insertions, 6 deletions
diff --git a/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr b/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr index 2f45415844d..1599edd7a99 100644 --- a/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr +++ b/tests/ui/pattern/bindings-after-at/wild-before-at-syntactically-rejected.stderr @@ -6,7 +6,11 @@ LL | let _ @ a = 0; | | | | | binding on the right, should be on the left | pattern on the left, should be on the right - | help: switch the order: `a @ _` + | +help: switch the order + | +LL | let a @ _ = 0; + | ~~~~~ error: pattern on wrong side of `@` --> $DIR/wild-before-at-syntactically-rejected.rs:10:9 @@ -16,7 +20,11 @@ LL | let _ @ ref a = 0; | | | | | binding on the right, should be on the left | pattern on the left, should be on the right - | help: switch the order: `ref a @ _` + | +help: switch the order + | +LL | let ref a @ _ = 0; + | ~~~~~~~~~ error: pattern on wrong side of `@` --> $DIR/wild-before-at-syntactically-rejected.rs:12:9 @@ -26,7 +34,11 @@ LL | let _ @ ref mut a = 0; | | | | | binding on the right, should be on the left | pattern on the left, should be on the right - | help: switch the order: `ref mut a @ _` + | +help: switch the order + | +LL | let ref mut a @ _ = 0; + | ~~~~~~~~~~~~~ error: left-hand side of `@` must be a binding --> $DIR/wild-before-at-syntactically-rejected.rs:14:9 diff --git a/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr b/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr index 167016397d2..622358126b0 100644 --- a/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr +++ b/tests/ui/pattern/issue-80186-mut-binding-help-suggestion.stderr @@ -2,9 +2,13 @@ error: `mut` must be attached to each individual binding --> $DIR/issue-80186-mut-binding-help-suggestion.rs:5:9 | LL | let mut &x = &0; - | ^^^^^^ help: add `mut` to each binding: `&(mut x)` + | ^^^^^^ | = note: `mut` may be followed by `variable` and `variable @ pattern` +help: add `mut` to each binding + | +LL | let &(mut x) = &0; + | ~~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/pattern/pattern-bad-ref-box-order.stderr b/tests/ui/pattern/pattern-bad-ref-box-order.stderr index a49f05c1028..a89d3ed21b6 100644 --- a/tests/ui/pattern/pattern-bad-ref-box-order.stderr +++ b/tests/ui/pattern/pattern-bad-ref-box-order.stderr @@ -2,7 +2,12 @@ error: switch the order of `ref` and `box` --> $DIR/pattern-bad-ref-box-order.rs:8:14 | LL | Some(ref box _i) => {}, - | ^^^^^^^ help: swap them: `box ref` + | ^^^^^^^ + | +help: swap them + | +LL | Some(box ref _i) => {}, + | ~~~~~~~ error: aborting due to 1 previous error diff --git a/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr b/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr index 37c02eb6ada..9d642b9245a 100644 --- a/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr +++ b/tests/ui/pattern/range-pattern-meant-to-be-slice-rest-pattern.stderr @@ -2,7 +2,12 @@ error: range-to patterns with `...` are not allowed --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:17:13 | LL | [_, ...tail] => println!("{tail}"), - | ^^^ help: use `..=` instead + | ^^^ + | +help: use `..=` instead + | +LL | [_, ..=tail] => println!("{tail}"), + | ~~~ error[E0425]: cannot find value `rest` in this scope --> $DIR/range-pattern-meant-to-be-slice-rest-pattern.rs:3:13 |
