diff --git a/compiler/rustc_parse/src/parser/expr.rs b/compiler/rustc_parse/src/parser/expr.rs index 2f8e3bb649730..91bb2d9eb666f 100644 --- a/compiler/rustc_parse/src/parser/expr.rs +++ b/compiler/rustc_parse/src/parser/expr.rs @@ -2998,7 +2998,6 @@ impl<'a> Parser<'a> { } else { Applicability::MaybeIncorrect }; - // self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore); err.span_suggestion_verbose(sugg_sp, msg, "=> ".to_string(), applicability); } } @@ -3171,7 +3170,7 @@ impl<'a> Parser<'a> { self.token.span.shrink_to_lo(), "try naming a field", &format!("{ident}: ", ), - Applicability::HasPlaceholders, + Applicability::MaybeIncorrect, ); } if in_if_guard && close_delim == Delimiter::Brace { @@ -3325,7 +3324,7 @@ impl<'a> Parser<'a> { // Check if a colon exists one ahead. This means we're parsing a fieldname. let is_shorthand = !this.look_ahead(1, |t| t == &token::Colon || t == &token::Eq); - // Proactively check whether parsing the field will be correct. + // Proactively check whether parsing the field will be incorrect. let is_wrong = this.token.is_ident() && !this.token.is_reserved_ident() && !this.look_ahead(1, |t| { diff --git a/tests/ui/parser/missing-fat-arrow.rs b/tests/ui/parser/missing-fat-arrow.rs index fef16129cd0d1..325f1ccf2fd93 100644 --- a/tests/ui/parser/missing-fat-arrow.rs +++ b/tests/ui/parser/missing-fat-arrow.rs @@ -6,11 +6,8 @@ fn main() { match value { Some(x) if x == y { self.next_token()?; //~ ERROR expected identifier, found keyword `self` - Ok(true) }, - _ => { - Ok(false) - } + _ => {} } let _: i32 = (); //~ ERROR mismatched types } diff --git a/tests/ui/parser/missing-fat-arrow.stderr b/tests/ui/parser/missing-fat-arrow.stderr index abfed7a5683cf..a6c786905e935 100644 --- a/tests/ui/parser/missing-fat-arrow.stderr +++ b/tests/ui/parser/missing-fat-arrow.stderr @@ -12,7 +12,7 @@ LL | Some(x) if x == y => { | ++ error: expected one of `,`, `:`, or `}`, found `.` - --> $DIR/missing-fat-arrow.rs:25:14 + --> $DIR/missing-fat-arrow.rs:22:14 | LL | Some(a) if a.value == b { | - while parsing this struct @@ -31,7 +31,7 @@ LL | Some(a) if a.value == b => { | ++ error: expected one of `,`, `:`, or `}`, found `.` - --> $DIR/missing-fat-arrow.rs:35:14 + --> $DIR/missing-fat-arrow.rs:32:14 | LL | Some(a) if a.value == b { | - while parsing this struct @@ -50,7 +50,7 @@ LL | Some(a) if a.value == b => { | ++ error[E0308]: mismatched types - --> $DIR/missing-fat-arrow.rs:15:18 + --> $DIR/missing-fat-arrow.rs:12:18 | LL | let _: i32 = (); | --- ^^ expected `i32`, found `()` @@ -58,7 +58,7 @@ LL | let _: i32 = (); | expected due to this error[E0308]: mismatched types - --> $DIR/missing-fat-arrow.rs:29:18 + --> $DIR/missing-fat-arrow.rs:26:18 | LL | let _: i32 = (); | --- ^^ expected `i32`, found `()` @@ -66,7 +66,7 @@ LL | let _: i32 = (); | expected due to this error[E0308]: mismatched types - --> $DIR/missing-fat-arrow.rs:40:18 + --> $DIR/missing-fat-arrow.rs:37:18 | LL | let _: i32 = (); | --- ^^ expected `i32`, found `()`