@@ -1404,7 +1404,7 @@ impl<'a> Parser<'a> {
1404
1404
// definition...
1405
1405
1406
1406
// 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 )
1408
1408
} ) ?;
1409
1409
generics. where_clause = self . parse_where_clause ( ) ?;
1410
1410
@@ -1817,7 +1817,7 @@ impl<'a> Parser<'a> {
1817
1817
1818
1818
/// This version of parse arg doesn't necessarily require
1819
1819
/// 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 > {
1821
1821
maybe_whole ! ( self , NtArg , |x| x) ;
1822
1822
1823
1823
if let Ok ( Some ( _) ) = self . parse_self_arg ( ) {
@@ -1849,6 +1849,8 @@ impl<'a> Parser<'a> {
1849
1849
String :: from ( "<identifier>: <type>" ) ,
1850
1850
Applicability :: HasPlaceholders ,
1851
1851
) ;
1852
+ } else if require_name && is_trait_item {
1853
+ err. note ( "anonymous parameters are removed in the 2018 edition (see RFC 1685)" ) ;
1852
1854
}
1853
1855
1854
1856
return Err ( err) ;
@@ -1914,7 +1916,7 @@ impl<'a> Parser<'a> {
1914
1916
1915
1917
/// Parse a single function argument
1916
1918
crate fn parse_arg ( & mut self ) -> PResult < ' a , Arg > {
1917
- self . parse_arg_general ( true )
1919
+ self . parse_arg_general ( true , false )
1918
1920
}
1919
1921
1920
1922
/// Parse an argument in a lambda header e.g. |arg, arg|
@@ -5469,7 +5471,7 @@ impl<'a> Parser<'a> {
5469
5471
}
5470
5472
}
5471
5473
} else {
5472
- match p. parse_arg_general ( named_args) {
5474
+ match p. parse_arg_general ( named_args, false ) {
5473
5475
Ok ( arg) => Ok ( Some ( arg) ) ,
5474
5476
Err ( mut e) => {
5475
5477
e. emit ( ) ;
0 commit comments