diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 7af88e32aec0d..2cd7208b1d9dd 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -1,3 +1,4 @@ +// ignore-tidy-filelength use super::diagnostics::SnapshotParser; use super::pat::{CommaRecoveryMode, Expected, RecoverColon, RecoverComma}; use super::ty::{AllowPlus, RecoverQPath, RecoverReturnSign}; diff --git a/tests/ui/parser/recover/recover-parens-around-match-arm-head.fixed b/tests/ui/parser/recover/recover-parens-around-match-arm-head.fixed new file mode 100644 index 0000000000000..6b9b7fa882a07 --- /dev/null +++ b/tests/ui/parser/recover/recover-parens-around-match-arm-head.fixed @@ -0,0 +1,12 @@ +// run-rustfix +fn main() { + let val = 42; + let x = match val { + 0 if true => { + //~^ ERROR unexpected parentheses surrounding `match` arm pattern + 42u8 + } + _ => 0u8, + }; + let _y: u32 = x.into(); //~ ERROR mismatched types +} diff --git a/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs b/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs index 20d27c256563b..f523581e2da19 100644 --- a/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs +++ b/tests/ui/parser/recover/recover-parens-around-match-arm-head.rs @@ -1,3 +1,4 @@ +// run-rustfix fn main() { let val = 42; let x = match val { @@ -8,4 +9,4 @@ fn main() { _ => 0u8, }; let _y: u32 = x; //~ ERROR mismatched types -} \ No newline at end of file +} diff --git a/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr b/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr index 0d1143fbc99f4..bad4d7d2f19f5 100644 --- a/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr +++ b/tests/ui/parser/recover/recover-parens-around-match-arm-head.stderr @@ -1,5 +1,5 @@ error: unexpected parentheses surrounding `match` arm pattern - --> $DIR/recover-parens-around-match-arm-head.rs:4:9 + --> $DIR/recover-parens-around-match-arm-head.rs:5:9 | LL | (0 if true) => { | ^ ^ @@ -11,7 +11,7 @@ LL + 0 if true => { | error[E0308]: mismatched types - --> $DIR/recover-parens-around-match-arm-head.rs:10:19 + --> $DIR/recover-parens-around-match-arm-head.rs:11:19 | LL | let _y: u32 = x; | --- ^ expected `u32`, found `u8`