Skip to content

Conversation

A4-Tacks
Copy link
Contributor

@A4-Tacks A4-Tacks commented Jul 2, 2025

Fix #143330

@rustbot
Copy link
Collaborator

rustbot commented Jul 2, 2025

r? @compiler-errors

rustbot has assigned @compiler-errors.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 2, 2025
@folkertdev
Copy link
Contributor

You should probably add a test in tests/ui/parser/ with the input from the issue, and run ./x test tests/ui/parser --bless to get the error output in a .stderr file. That way, this message won't regress in the future.

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-19-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens/issue-48492-tuple-destructure-missing-parens.stderr`
diff of stderr:

32    |
33 LL |         (Nucleotide::Adenine, Nucleotide::Cytosine, _) => true
34    |         +                                            +
- help: ...or a vertical bar to match on multiple alternatives
+ help: ...or a vertical bar to match on alternative
36    |
37 LL -         Nucleotide::Adenine, Nucleotide::Cytosine, _ => true
- LL +         Nucleotide::Adenine | Nucleotide::Cytosine | _ => true
+ LL +         Nucleotide::Adenine | Nucleotide::Cytosine, _ => true
39    |
40 
41 error: unexpected `,` in pattern


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args did_you_mean/issue-48492-tuple-destructure-missing-parens.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: unexpected `,` in pattern
##[error]  --> /checkout/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs:38:17
   |
LL |     while let b1, b2, b3 = reading_frame.next().expect("there should be a start codon") {
   |     -----       ^
   |     |
   |     while parsing the condition of this `while` expression
   |
help: try adding parentheses to match on a tuple
   |
LL |     while let (b1, b2, b3) = reading_frame.next().expect("there should be a start codon") {
   |               +          +

error: unexpected `,` in pattern
##[error]  --> /checkout/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs:49:14
   |
LL |     if let b1, b2, b3 = reading_frame.next().unwrap() {
   |              ^
   |
help: try adding parentheses to match on a tuple
   |
LL |     if let (b1, b2, b3) = reading_frame.next().unwrap() {
   |            +          +

error: unexpected `,` in pattern
##[error]  --> /checkout/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs:59:28
   |
LL |         Nucleotide::Adenine, Nucleotide::Cytosine, _ => true
   |                            ^
   |
help: try adding parentheses to match on a tuple...
   |
LL |         (Nucleotide::Adenine, Nucleotide::Cytosine, _) => true
   |         +                                            +
help: ...or a vertical bar to match on alternative
   |
LL -         Nucleotide::Adenine, Nucleotide::Cytosine, _ => true
LL +         Nucleotide::Adenine | Nucleotide::Cytosine, _ => true
   |

error: unexpected `,` in pattern
##[error]  --> /checkout/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs:67:10
   |
LL |     for x, _barr_body in women.iter().map(|woman| woman.allosomes.clone()) {
   |          ^
   |
help: try adding parentheses to match on a tuple
   |
LL |     for (x, _barr_body) in women.iter().map(|woman| woman.allosomes.clone()) {
   |         +             +

error: unexpected `,` in pattern
##[error]  --> /checkout/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs:75:10
   |
LL |     for x, y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) {
   |          ^
   |
help: try adding parentheses to match on a tuple
   |
LL |     for (x, y @ Allosome::Y(_)) in men.iter().map(|man| man.allosomes.clone()) {
   |         +                     +

error: unexpected `,` in pattern
##[error]  --> /checkout/tests/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs:84:14
   |
LL |     let women, men: (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()
   |              ^
   |
help: try adding parentheses to match on a tuple
   |
LL |     let (women, men): (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()
   |         +          +

error: aborting due to 6 previous errors
------------------------------------------

---

8    |
9 LL |         (Some(_),)
10    |         +        +
- help: ...or a vertical bar to match on multiple alternatives
+ help: ...or a vertical bar to match on alternative
12    |
13 LL -         Some(_),
14 LL +         Some(_) |


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args feature-gates/feature-gate-never_patterns.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/feature-gates/feature-gate-never_patterns.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/feature-gates/feature-gate-never_patterns" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: unexpected `,` in pattern
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-never_patterns.rs:33:16
   |
LL |         Some(_),
   |                ^
   |
help: try adding parentheses to match on a tuple...
   |
LL |         (Some(_),)
   |         +        +
help: ...or a vertical bar to match on alternative
   |
LL -         Some(_),
LL +         Some(_) |
   |

error[E0658]: `!` patterns are experimental
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-never_patterns.rs:8:24
   |
LL |     let (Ok(_x) | Err(&!)) = res.as_ref();
   |                        ^
   |
   = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
   = help: add `#![feature(never_patterns)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: `!` patterns are experimental
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-never_patterns.rs:14:13
   |
LL |             !
   |             ^
   |
   = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
   = help: add `#![feature(never_patterns)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: `!` patterns are experimental
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-never_patterns.rs:20:13
   |
LL |             !
   |             ^
   |
   = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
   = help: add `#![feature(never_patterns)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: `!` patterns are experimental
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-never_patterns.rs:25:13
   |
LL |             ! => {}
   |             ^
   |
   = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
   = help: add `#![feature(never_patterns)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: `match` arm with no body
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-never_patterns.rs:38:9
   |
LL |         Some(_)
---
   |             ^
   |
   = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
   = help: add `#![feature(never_patterns)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error[E0658]: `!` patterns are experimental
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-never_patterns.rs:54:13
   |
LL |         Err(!) if false,
   |             ^
   |
   = note: see issue #118155 <https://github.com/rust-lang/rust/issues/118155> for more information
   = help: add `#![feature(never_patterns)]` to the crate attributes to enable
   = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date

error: `match` arm with no body
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-never_patterns.rs:64:9
   |
LL |         Some(_)
---

error: a guard on a never pattern will never be run
##[error]  --> /checkout/tests/ui/feature-gates/feature-gate-never_patterns.rs:54:19
   |
LL |         Err(!) if false,
   |                   ^^^^^ help: remove this guard

error: aborting due to 13 previous errors

For more information about this error, try `rustc --explain E0658`.
------------------------------------------
---

16    |
17 LL |         (Some(_),)
18    |         +        +
- help: ...or a vertical bar to match on multiple alternatives
+ help: ...or a vertical bar to match on alternative
20    |
21 LL -         Some(_),
22 LL +         Some(_) |

36 LL |
37 LL ~         _) => {}
38    |
- help: ...or a vertical bar to match on multiple alternatives
+ help: ...or a vertical bar to match on alternative
40    |
- LL ~         Some(_) |
- LL +
- LL +
- LL +
- LL ~         _ => {}
+ LL -         Some(_),
+ LL +         Some(_) |
46    |
47 
48 error: expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_`


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args parser/match-arm-without-body.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/parser/match-arm-without-body.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/parser/match-arm-without-body" "-A" "unused" "-A" "internal_features" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers"
stdout: none
--- stderr -------------------------------
error: expected one of `=>`, `if`, or `|`, found reserved identifier `_`
##[error]  --> /checkout/tests/ui/parser/match-arm-without-body.rs:13:9
   |
LL |         Some(_)
   |                - expected one of `=>`, `if`, or `|`
LL |         _ => {}
   |         ^ unexpected token

error: unexpected `,` in pattern
##[error]  --> /checkout/tests/ui/parser/match-arm-without-body.rs:17:16
   |
LL |         Some(_),
   |                ^
   |
help: try adding parentheses to match on a tuple...
   |
LL |         (Some(_),)
   |         +        +
help: ...or a vertical bar to match on alternative
   |
LL -         Some(_),
LL +         Some(_) |
   |

error: unexpected `,` in pattern
##[error]  --> /checkout/tests/ui/parser/match-arm-without-body.rs:23:16
   |
LL |         Some(_),
   |                ^
   |
help: try adding parentheses to match on a tuple...
   |
LL ~         (Some(_),
LL |         //~^ ERROR unexpected `,` in pattern
LL |         //~| HELP try adding parentheses to match on a tuple
LL |         //~| HELP or a vertical bar to match on multiple alternatives
LL ~         _) => {}
   |
help: ...or a vertical bar to match on alternative
   |
LL -         Some(_),
LL +         Some(_) |
   |

error: expected one of `.`, `=>`, `?`, or an operator, found reserved identifier `_`
##[error]  --> /checkout/tests/ui/parser/match-arm-without-body.rs:36:9
   |
LL |         Some(_) if true
   |                        - expected one of `.`, `=>`, `?`, or an operator
LL |         _ => {}
   |         ^ unexpected token

error: expected `,` following `match` arm
##[error]  --> /checkout/tests/ui/parser/match-arm-without-body.rs:66:15
   |
LL |         pat!()
   |               ^
   |

@Kivooeo
Copy link
Member

Kivooeo commented Jul 2, 2025

This will definitely need test updates with reblessing as mentioned above - not just the parser/ but the entire tests/ui, since the CI errors are coming from various parts.

Could you clarify how this change was tested locally? It would help to understand the testing approach used, especially, given that no new tests were added and existing ones weren't updated

@Kivooeo
Copy link
Member

Kivooeo commented Jul 6, 2025

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 6, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jul 6, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@karolzwolak
Copy link
Member

Thanks for your contribution @A4-Tacks.
Could you address the comments above?
tip: to fix the failing tests, run ./x test ui --bless

@A4-Tacks A4-Tacks marked this pull request as draft August 24, 2025 15:14
@A4-Tacks
Copy link
Contributor Author

I may need some time to study how to make it

@Dylan-DPC
Copy link
Member

@A4-Tacks any updates on this? if you need help let us know

@A4-Tacks A4-Tacks closed this Sep 27, 2025
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Sep 27, 2025
@A4-Tacks
Copy link
Contributor Author

My computer's performance cannot complete this PR, sorry

@karolzwolak
Copy link
Member

No worries @A4-Tacks. I can rebase this PR onto the tip of the master and bless the tests for you.

@karolzwolak
Copy link
Member

I can't add any commits to this PR, so I had a make a new one.

@A4-Tacks
Copy link
Contributor Author

A4-Tacks commented Oct 2, 2025

No worries @A4-Tacks. I can rebase this PR onto the tip of the master and bless the tests for you.

Thanks!

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Oct 3, 2025
…bar-not-all-in-pattern, r=lcnr

only replace the intended comma in pattern suggestions

Only suggest to replace the intended comma, not all bars in the pattern.
Fixes rust-lang#143330.
This continues rust-lang#143331, the credit for making the fix goes to `@A4-Tacks.` I just blessed tests and added a regression test.
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 4, 2025
…bar-not-all-in-pattern, r=lcnr

only replace the intended comma in pattern suggestions

Only suggest to replace the intended comma, not all bars in the pattern.
Fixes rust-lang#143330.
This continues rust-lang#143331, the credit for making the fix goes to ``@A4-Tacks.`` I just blessed tests and added a regression test.
Zalathar added a commit to Zalathar/rust that referenced this pull request Oct 4, 2025
…bar-not-all-in-pattern, r=lcnr

only replace the intended comma in pattern suggestions

Only suggest to replace the intended comma, not all bars in the pattern.
Fixes rust-lang#143330.
This continues rust-lang#143331, the credit for making the fix goes to ```@A4-Tacks.``` I just blessed tests and added a regression test.
rust-timer added a commit that referenced this pull request Oct 4, 2025
Rollup merge of #147245 - karolzwolak:only-replace-intended-bar-not-all-in-pattern, r=lcnr

only replace the intended comma in pattern suggestions

Only suggest to replace the intended comma, not all bars in the pattern.
Fixes #143330.
This continues #143331, the credit for making the fix goes to `@A4-Tacks.` I just blessed tests and added a regression test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

...or a vertical bar to match bugs
8 participants