1
Fork 0
This commit is contained in:
yukang 2023-05-13 18:06:58 +08:00
parent ce6cfc37d0
commit 83789b8b06
3 changed files with 4 additions and 8 deletions

View file

@ -1181,12 +1181,9 @@ impl<'a> Parser<'a> {
let close_paren = self.prev_token.span; let close_paren = self.prev_token.span;
let span = lo.to(close_paren); let span = lo.to(close_paren);
// filter shorthand fields // filter shorthand fields
let fields: Vec<_> = fields let fields: Vec<_> =
.into_iter() fields.into_iter().filter(|field| !field.is_shorthand).collect();
.filter_map(
|field| if !field.is_shorthand { Some(field) } else { None },
)
.collect();
if !fields.is_empty() && if !fields.is_empty() &&
// `token.kind` should not be compared here. // `token.kind` should not be compared here.
// This is because the `snapshot.token.kind` is treated as the same as // This is because the `snapshot.token.kind` is treated as the same as

View file

@ -1,4 +1,3 @@
fn main() { fn main() {
let my = monad_bind(mx, T: Try); //~ ERROR invalid `struct` delimiters or `fn` call arguments let my = monad_bind(mx, T: Try); //~ ERROR invalid `struct` delimiters or `fn` call arguments
} }

View file

@ -1,5 +1,5 @@
error: invalid `struct` delimiters or `fn` call arguments error: invalid `struct` delimiters or `fn` call arguments
--> $DIR/issue-111416.rs:3:14 --> $DIR/issue-111416.rs:2:14
| |
LL | let my = monad_bind(mx, T: Try); LL | let my = monad_bind(mx, T: Try);
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^