review comments

This commit is contained in:
Esteban Küber 2023-10-04 01:35:07 +00:00
parent 18ec4e9bcd
commit 8fd345dd4b
3 changed files with 8 additions and 12 deletions

View file

@ -2998,7 +2998,6 @@ fn parse_match_guard_condition(&mut self) -> PResult<'a, P<Expr>> {
} else {
Applicability::MaybeIncorrect
};
// self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore);
err.span_suggestion_verbose(sugg_sp, msg, "=> ".to_string(), applicability);
}
}
@ -3171,7 +3170,7 @@ pub(super) fn parse_struct_fields(
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 @@ fn parse_expr_field(&mut self) -> PResult<'a, ExprField> {
// 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| {

View file

@ -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
}

View file

@ -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 `()`