@@ -1404,7 +1404,7 @@ impl<'a> Parser<'a> {
14041404 // definition...
14051405
14061406 // We don't allow argument names to be left off in edition 2018.
1407- p. parse_arg_general ( p. span . rust_2018 ( ) )
1407+ p. parse_arg_general ( p. span . rust_2018 ( ) , true )
14081408 } ) ?;
14091409 generics. where_clause = self . parse_where_clause ( ) ?;
14101410
@@ -1817,7 +1817,7 @@ impl<'a> Parser<'a> {
18171817
18181818 /// This version of parse arg doesn't necessarily require
18191819 /// identifier names.
1820- fn parse_arg_general ( & mut self , require_name : bool ) -> PResult < ' a , Arg > {
1820+ fn parse_arg_general ( & mut self , require_name : bool , is_trait_item : bool ) -> PResult < ' a , Arg > {
18211821 maybe_whole ! ( self , NtArg , |x| x) ;
18221822
18231823 if let Ok ( Some ( _) ) = self . parse_self_arg ( ) {
@@ -1849,6 +1849,8 @@ impl<'a> Parser<'a> {
18491849 String :: from ( "<identifier>: <type>" ) ,
18501850 Applicability :: HasPlaceholders ,
18511851 ) ;
1852+ } else if require_name && is_trait_item {
1853+ err. note ( "anonymous parameters are removed in the 2018 edition (see RFC 1685)" ) ;
18521854 }
18531855
18541856 return Err ( err) ;
@@ -1914,7 +1916,7 @@ impl<'a> Parser<'a> {
19141916
19151917 /// Parse a single function argument
19161918 crate fn parse_arg ( & mut self ) -> PResult < ' a , Arg > {
1917- self . parse_arg_general ( true )
1919+ self . parse_arg_general ( true , false )
19181920 }
19191921
19201922 /// Parse an argument in a lambda header e.g. |arg, arg|
@@ -5469,7 +5471,7 @@ impl<'a> Parser<'a> {
54695471 }
54705472 }
54715473 } else {
5472- match p. parse_arg_general ( named_args) {
5474+ match p. parse_arg_general ( named_args, false ) {
54735475 Ok ( arg) => Ok ( Some ( arg) ) ,
54745476 Err ( mut e) => {
54755477 e. emit ( ) ;
0 commit comments