File tree 3 files changed +25
-0
lines changed
compiler/rustc_parse/src/parser
3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1180,6 +1180,10 @@ impl<'a> Parser<'a> {
1180
1180
self . restore_snapshot ( snapshot) ;
1181
1181
let close_paren = self . prev_token . span ;
1182
1182
let span = lo. to ( close_paren) ;
1183
+ // filter shorthand fields
1184
+ let fields: Vec < _ > =
1185
+ fields. into_iter ( ) . filter ( |field| !field. is_shorthand ) . collect ( ) ;
1186
+
1183
1187
if !fields. is_empty ( ) &&
1184
1188
// `token.kind` should not be compared here.
1185
1189
// This is because the `snapshot.token.kind` is treated as the same as
Original file line number Diff line number Diff line change
1
+ fn main ( ) {
2
+ let my = monad_bind ( mx, T : Try ) ; //~ ERROR invalid `struct` delimiters or `fn` call arguments
3
+ }
Original file line number Diff line number Diff line change
1
+ error: invalid `struct` delimiters or `fn` call arguments
2
+ --> $DIR/issue-111416.rs:2:14
3
+ |
4
+ LL | let my = monad_bind(mx, T: Try);
5
+ | ^^^^^^^^^^^^^^^^^^^^^^
6
+ |
7
+ help: if `monad_bind` is a struct, use braces as delimiters
8
+ |
9
+ LL | let my = monad_bind { mx, T: Try };
10
+ | ~ ~
11
+ help: if `monad_bind` is a function, use the arguments directly
12
+ |
13
+ LL - let my = monad_bind(mx, T: Try);
14
+ LL + let my = monad_bind(mx, Try);
15
+ |
16
+
17
+ error: aborting due to previous error
18
+
You can’t perform that action at this time.
0 commit comments