@@ -6,6 +6,7 @@ use crate::maybe_whole;
6
6
7
7
use rustc_ast_pretty:: pprust;
8
8
use rustc_errors:: { struct_span_err, Applicability , PResult , StashKey } ;
9
+ use rustc_span:: edition:: Edition ;
9
10
use rustc_span:: source_map:: { self , Span } ;
10
11
use rustc_span:: symbol:: { kw, sym, Symbol } ;
11
12
use syntax:: ast:: { self , AttrStyle , AttrVec , Attribute , Ident , DUMMY_NODE_ID } ;
@@ -636,7 +637,7 @@ impl<'a> Parser<'a> {
636
637
}
637
638
638
639
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 )
640
641
}
641
642
642
643
/// Parses associated items.
@@ -1380,7 +1381,7 @@ impl<'a> Parser<'a> {
1380
1381
/// The parsing configuration used to parse a parameter list (see `parse_fn_params`).
1381
1382
///
1382
1383
/// 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 ;
1384
1385
1385
1386
/// Parsing of functions and methods.
1386
1387
impl < ' a > Parser < ' a > {
@@ -1536,7 +1537,7 @@ impl<'a> Parser<'a> {
1536
1537
1537
1538
let is_name_required = match self . token . kind {
1538
1539
token:: DotDotDot => false ,
1539
- _ => req_name ( & self . normalized_token ) ,
1540
+ _ => req_name ( self . normalized_token . span . edition ( ) ) ,
1540
1541
} ;
1541
1542
let ( pat, ty) = if is_name_required || self . is_named_param ( ) {
1542
1543
debug ! ( "parse_param_general parse_pat (is_name_required:{})" , is_name_required) ;
0 commit comments