File tree 3 files changed +27
-4
lines changed
3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -7408,10 +7408,13 @@ impl<'a> Parser<'a> {
7408
7408
} else if self . look_ahead ( 1 , |t| * t == token:: OpenDelim ( token:: Paren ) ) {
7409
7409
let ident = self . parse_ident ( ) . unwrap ( ) ;
7410
7410
self . bump ( ) ; // `(`
7411
- let kw_name = if let Ok ( Some ( _) ) = self . parse_self_arg_with_attrs ( ) {
7412
- "method"
7413
- } else {
7414
- "function"
7411
+ let kw_name = match self . parse_self_arg_with_attrs ( ) {
7412
+ Ok ( Some ( _) ) => "method" ,
7413
+ Ok ( None ) => "function" ,
7414
+ Err ( mut err) => {
7415
+ err. cancel ( ) ;
7416
+ "function"
7417
+ }
7415
7418
} ;
7416
7419
self . consume_block ( token:: Paren ) ;
7417
7420
let ( kw, kw_name, ambiguous) = if self . check ( & token:: RArrow ) {
Original file line number Diff line number Diff line change
1
+ pub t( #
2
+ //~^ ERROR missing `fn` or `struct` for function or struct definition
3
+ //~ ERROR this file contains an un-closed delimiter
Original file line number Diff line number Diff line change
1
+ error: this file contains an un-closed delimiter
2
+ --> $DIR/issue-62546.rs:3:53
3
+ |
4
+ LL | pub t(#
5
+ | - un-closed delimiter
6
+ LL |
7
+ LL |
8
+ | ^
9
+
10
+ error: missing `fn` or `struct` for function or struct definition
11
+ --> $DIR/issue-62546.rs:1:4
12
+ |
13
+ LL | pub t(#
14
+ | ---^- help: if you meant to call a macro, try: `t!`
15
+
16
+ error: aborting due to 2 previous errors
17
+
You can’t perform that action at this time.
0 commit comments