@@ -6,6 +6,7 @@ use crate::maybe_whole;
66
77use rustc_ast_pretty:: pprust;
88use rustc_errors:: { struct_span_err, Applicability , PResult , StashKey } ;
9+ use rustc_span:: edition:: Edition ;
910use rustc_span:: source_map:: { self , Span } ;
1011use rustc_span:: symbol:: { kw, sym, Symbol } ;
1112use syntax:: ast:: { self , AttrStyle , AttrVec , Attribute , Ident , DUMMY_NODE_ID } ;
@@ -636,7 +637,7 @@ impl<'a> Parser<'a> {
636637 }
637638
638639 pub fn parse_trait_item ( & mut self ) -> PResult < ' a , Option < Option < P < AssocItem > > > > {
639- self . parse_assoc_item ( |t| t . span . rust_2018 ( ) )
640+ self . parse_assoc_item ( |edition| edition >= Edition :: Edition2018 )
640641 }
641642
642643 /// Parses associated items.
@@ -1380,7 +1381,7 @@ impl<'a> Parser<'a> {
13801381/// The parsing configuration used to parse a parameter list (see `parse_fn_params`).
13811382///
13821383/// The function decides if, per-parameter `p`, `p` must have a pattern or just a type.
1383- type ReqName = fn ( & token :: Token ) -> bool ;
1384+ type ReqName = fn ( Edition ) -> bool ;
13841385
13851386/// Parsing of functions and methods.
13861387impl < ' a > Parser < ' a > {
@@ -1536,7 +1537,7 @@ impl<'a> Parser<'a> {
15361537
15371538 let is_name_required = match self . token . kind {
15381539 token:: DotDotDot => false ,
1539- _ => req_name ( & self . normalized_token ) ,
1540+ _ => req_name ( self . normalized_token . span . edition ( ) ) ,
15401541 } ;
15411542 let ( pat, ty) = if is_name_required || self . is_named_param ( ) {
15421543 debug ! ( "parse_param_general parse_pat (is_name_required:{})" , is_name_required) ;
0 commit comments