Change:
--> $DIR/issue-48492-tuple-destructure-missing-parens.rs:67:10 | LL |     for x, _barr_body in women.iter().map(|woman| woman.allosomes.clone()) { <del> |          ^ | help: try adding parentheses to match on a tuple... | LL |     for (x, _barr_body) in women.iter().map(|woman| woman.allosomes.clone()) { |         ^^^^^^^^^^^^^^^ help: ...or a vertical bar to match on multiple alternatives | LL |     for x | _barr_body in women.iter().map(|woman| woman.allosomes.clone()) { |         ^^^^^^^^^^^^^^ </del> <ins> |         -^----------- help: try adding parentheses to match on a tuple: `(x, _barr_body)` </ins> error: unexpected `,` in pattern --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:75:10 | LL |     for x, y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) { <del> |          ^ | help: try adding parentheses to match on a tuple... | LL |     for (x, y @ Allosome::Y(_)) in men.iter().map(|man| man.allosomes.clone()) { |         ^^^^^^^^^^^^^^^^^^^^^^^ help: ...or a vertical bar to match on multiple alternatives | LL |     for x | y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) { |         ^^^^^^^^^^^^^^^^^^^^^^ </del> <ins> |         -^------------------- help: try adding parentheses to match on a tuple: `(x, y @ Allosome::Y(_))` </ins> error: unexpected `,` in pattern --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:84:14 | LL |     let women, men: (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned() <del> |              ^ | help: try adding parentheses to match on a tuple... | LL |     let (women, men): (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned() |         ^^^^^^^^^^^^ help: ...or a vertical bar to match on multiple alternatives | LL |     let women | men: (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned() |         ^^^^^^^^^^^ </del> <ins> |         -----^---- help: try adding parentheses to match on a tuple: `(women, men)` </ins> error: aborting due to 6 previous errors

Discussion:
When forgetting to include parenthesis around a tuple pattern in a for loop, the compiler gives a suggestion to use an or pattern. I would expect this, a. because it's not what most would expect if you use a comma to separate two values in a pattern, and b. because or patterns in for loops are still an unstable feature. I tried this code: As expected, the compiler gives an , error, because I forgot the parenthesis around . However, the compiler also suggests that I add a "vertical bar to match on multiple alternatives". While it does provide the correct answer (adding parenthesis), it also provides the vertical bar option, which is an unstable feature in this . While the RFC does not explicitly single out for loops as a situation where this is necessary, I believe it does apply here, because in (credit /u/ehuss for the example, which is a situation where the or pattern syntax is being used correctly, I get a error, as expected, and including resolves the error. I tested this on stable, beta, and nightly in the rust playground. The output is identical for all 3 of them. <!-- TRIAGEBOTSTART --<!-- TRIAGEBOTASSIGNSTART --<!-- TRIAGEBOTASSIGNDATASTARTTRIAGEBOTASSIGNDATAEND --<!-- TRIAGEBOTASSIGNEND --<!-- TRIAGEBOT_END --
I would like to work on this, if possible Would it just be only giving if like ?
that seems like the right approach :)
claim
Looking at this more closely I'm not sure the fix is that simple, since and seems to (Which matches the comment for )
Looking at usages of GateOr::{Yes, No}, it looks like the only top level things (Which are the only ones that give the suggestion AIUI) that are GateOr::Yes are local variable declaration patterns and for patterns EDIT: I'm gonna try just propagating the GateOr into mayberecoverunexpected_comma