Skip to content

Commit 8fd345d

Browse files
committed
review comments
1 parent 18ec4e9 commit 8fd345d

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

compiler/rustc_parse/src/parser/expr.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -2998,7 +2998,6 @@ impl<'a> Parser<'a> {
29982998
} else {
29992999
Applicability::MaybeIncorrect
30003000
};
3001-
// self.recover_stmt_(SemiColonMode::Ignore, BlockMode::Ignore);
30023001
err.span_suggestion_verbose(sugg_sp, msg, "=> ".to_string(), applicability);
30033002
}
30043003
}
@@ -3171,7 +3170,7 @@ impl<'a> Parser<'a> {
31713170
self.token.span.shrink_to_lo(),
31723171
"try naming a field",
31733172
&format!("{ident}: ", ),
3174-
Applicability::HasPlaceholders,
3173+
Applicability::MaybeIncorrect,
31753174
);
31763175
}
31773176
if in_if_guard && close_delim == Delimiter::Brace {
@@ -3325,7 +3324,7 @@ impl<'a> Parser<'a> {
33253324

33263325
// Check if a colon exists one ahead. This means we're parsing a fieldname.
33273326
let is_shorthand = !this.look_ahead(1, |t| t == &token::Colon || t == &token::Eq);
3328-
// Proactively check whether parsing the field will be correct.
3327+
// Proactively check whether parsing the field will be incorrect.
33293328
let is_wrong = this.token.is_ident()
33303329
&& !this.token.is_reserved_ident()
33313330
&& !this.look_ahead(1, |t| {

tests/ui/parser/missing-fat-arrow.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,8 @@ fn main() {
66
match value {
77
Some(x) if x == y {
88
self.next_token()?; //~ ERROR expected identifier, found keyword `self`
9-
Ok(true)
109
},
11-
_ => {
12-
Ok(false)
13-
}
10+
_ => {}
1411
}
1512
let _: i32 = (); //~ ERROR mismatched types
1613
}

tests/ui/parser/missing-fat-arrow.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ LL | Some(x) if x == y => {
1212
| ++
1313

1414
error: expected one of `,`, `:`, or `}`, found `.`
15-
--> $DIR/missing-fat-arrow.rs:25:14
15+
--> $DIR/missing-fat-arrow.rs:22:14
1616
|
1717
LL | Some(a) if a.value == b {
1818
| - while parsing this struct
@@ -31,7 +31,7 @@ LL | Some(a) if a.value == b => {
3131
| ++
3232

3333
error: expected one of `,`, `:`, or `}`, found `.`
34-
--> $DIR/missing-fat-arrow.rs:35:14
34+
--> $DIR/missing-fat-arrow.rs:32:14
3535
|
3636
LL | Some(a) if a.value == b {
3737
| - while parsing this struct
@@ -50,23 +50,23 @@ LL | Some(a) if a.value == b => {
5050
| ++
5151

5252
error[E0308]: mismatched types
53-
--> $DIR/missing-fat-arrow.rs:15:18
53+
--> $DIR/missing-fat-arrow.rs:12:18
5454
|
5555
LL | let _: i32 = ();
5656
| --- ^^ expected `i32`, found `()`
5757
| |
5858
| expected due to this
5959

6060
error[E0308]: mismatched types
61-
--> $DIR/missing-fat-arrow.rs:29:18
61+
--> $DIR/missing-fat-arrow.rs:26:18
6262
|
6363
LL | let _: i32 = ();
6464
| --- ^^ expected `i32`, found `()`
6565
| |
6666
| expected due to this
6767

6868
error[E0308]: mismatched types
69-
--> $DIR/missing-fat-arrow.rs:40:18
69+
--> $DIR/missing-fat-arrow.rs:37:18
7070
|
7171
LL | let _: i32 = ();
7272
| --- ^^ expected `i32`, found `()`

0 commit comments

Comments
 (0)