diff options
| author | Karol Zwolak <karolzwolak7@gmail.com> | 2025-10-02 20:13:18 +0200 |
|---|---|---|
| committer | Karol Zwolak <karolzwolak7@gmail.com> | 2025-10-02 20:13:18 +0200 |
| commit | 5a8f963426c72c5bd306b2620a6c148b720217d0 (patch) | |
| tree | 4d5d97e42f312fd930514008876b6ac0ad70e37a /tests/ui/suggestions/only-replace-intended-coma-not-all-in-pattern.fixed | |
| parent | 934ad740270944800d03f6290bcc131a8697e59f (diff) | |
| download | rust-5a8f963426c72c5bd306b2620a6c148b720217d0.tar.gz rust-5a8f963426c72c5bd306b2620a6c148b720217d0.zip | |
fix wording; we're replacing coma with a bar
Diffstat (limited to 'tests/ui/suggestions/only-replace-intended-coma-not-all-in-pattern.fixed')
| -rw-r--r-- | tests/ui/suggestions/only-replace-intended-coma-not-all-in-pattern.fixed | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/ui/suggestions/only-replace-intended-coma-not-all-in-pattern.fixed b/tests/ui/suggestions/only-replace-intended-coma-not-all-in-pattern.fixed new file mode 100644 index 00000000000..0258f868f00 --- /dev/null +++ b/tests/ui/suggestions/only-replace-intended-coma-not-all-in-pattern.fixed @@ -0,0 +1,18 @@ +//@ run-rustfix + +// Regression test for issue #143330. +// Ensure we suggest to replace only the intended coma with a bar, not all commas in the pattern. + +fn main() { + struct Foo { x: i32, ch: char } + let pos = Foo { x: 2, ch: 'x' }; + match pos { + // All commas here were replaced with bars. + // Foo { x: 2 | ch: ' |' } | Foo { x: 3 | ch: '@' } => (), + (Foo { x: 2, ch: ',' } | Foo { x: 3, ch: '@' }) => (), + //~^ ERROR unexpected `,` in pattern + //~| HELP try adding parentheses to match on a tuple... + //~| HELP ...or a vertical bar to match on alternative + _ => todo!(), + } +} |
