@@ -1903,7 +1903,7 @@ impl<'a> Parser<'a> {
19031903 self . expect ( & token:: ModSep ) ?;
19041904
19051905 let mut path = ast:: Path { segments : Vec :: new ( ) , span : syntax_pos:: DUMMY_SP } ;
1906- self . parse_path_segments ( & mut path. segments , T :: PATH_STYLE , true ) ?;
1906+ self . parse_path_segments ( & mut path. segments , T :: PATH_STYLE ) ?;
19071907 path. span = ty_span. to ( self . prev_span ) ;
19081908
19091909 let ty_str = self . sess . source_map ( ) . span_to_snippet ( ty_span)
@@ -2294,7 +2294,7 @@ impl<'a> Parser<'a> {
22942294 self . expect ( & token:: ModSep ) ?;
22952295
22962296 let qself = QSelf { ty, path_span, position : path. segments . len ( ) } ;
2297- self . parse_path_segments ( & mut path. segments , style, true ) ?;
2297+ self . parse_path_segments ( & mut path. segments , style) ?;
22982298
22992299 Ok ( ( qself, ast:: Path { segments : path. segments , span : lo. to ( self . prev_span ) } ) )
23002300 }
@@ -2310,11 +2310,6 @@ impl<'a> Parser<'a> {
23102310 /// `Fn(Args)` (without disambiguator)
23112311 /// `Fn::(Args)` (with disambiguator)
23122312 pub fn parse_path ( & mut self , style : PathStyle ) -> PResult < ' a , ast:: Path > {
2313- self . parse_path_common ( style, true )
2314- }
2315-
2316- crate fn parse_path_common ( & mut self , style : PathStyle , enable_warning : bool )
2317- -> PResult < ' a , ast:: Path > {
23182313 maybe_whole ! ( self , NtPath , |path| {
23192314 if style == PathStyle :: Mod &&
23202315 path. segments. iter( ) . any( |segment| segment. args. is_some( ) ) {
@@ -2329,7 +2324,7 @@ impl<'a> Parser<'a> {
23292324 if self . eat ( & token:: ModSep ) {
23302325 segments. push ( PathSegment :: path_root ( lo. shrink_to_lo ( ) . with_ctxt ( mod_sep_ctxt) ) ) ;
23312326 }
2332- self . parse_path_segments ( & mut segments, style, enable_warning ) ?;
2327+ self . parse_path_segments ( & mut segments, style) ?;
23332328
23342329 Ok ( ast:: Path { segments, span : lo. to ( self . prev_span ) } )
23352330 }
@@ -2357,11 +2352,10 @@ impl<'a> Parser<'a> {
23572352
23582353 fn parse_path_segments ( & mut self ,
23592354 segments : & mut Vec < PathSegment > ,
2360- style : PathStyle ,
2361- enable_warning : bool )
2355+ style : PathStyle )
23622356 -> PResult < ' a , ( ) > {
23632357 loop {
2364- let segment = self . parse_path_segment ( style, enable_warning ) ?;
2358+ let segment = self . parse_path_segment ( style) ?;
23652359 if style == PathStyle :: Expr {
23662360 // In order to check for trailing angle brackets, we must have finished
23672361 // recursing (`parse_path_segment` can indirectly call this function),
@@ -2389,8 +2383,7 @@ impl<'a> Parser<'a> {
23892383 }
23902384 }
23912385
2392- fn parse_path_segment ( & mut self , style : PathStyle , enable_warning : bool )
2393- -> PResult < ' a , PathSegment > {
2386+ fn parse_path_segment ( & mut self , style : PathStyle ) -> PResult < ' a , PathSegment > {
23942387 let ident = self . parse_path_segment_ident ( ) ?;
23952388
23962389 let is_args_start = |token : & token:: Token | match * token {
@@ -2407,13 +2400,6 @@ impl<'a> Parser<'a> {
24072400 Ok ( if style == PathStyle :: Type && check_args_start ( self ) ||
24082401 style != PathStyle :: Mod && self . check ( & token:: ModSep )
24092402 && self . look_ahead ( 1 , |t| is_args_start ( t) ) {
2410- // Generic arguments are found - `<`, `(`, `::<` or `::(`.
2411- if self . eat ( & token:: ModSep ) && style == PathStyle :: Type && enable_warning {
2412- self . diagnostic ( ) . struct_span_warn ( self . prev_span , "unnecessary path disambiguator" )
2413- . span_label ( self . prev_span , "try removing `::`" ) . emit ( ) ;
2414- }
2415- let lo = self . span ;
2416-
24172403 // We use `style == PathStyle::Expr` to check if this is in a recursion or not. If
24182404 // it isn't, then we reset the unmatched angle bracket count as we're about to start
24192405 // parsing a new path.
@@ -2422,6 +2408,9 @@ impl<'a> Parser<'a> {
24222408 self . max_angle_bracket_count = 0 ;
24232409 }
24242410
2411+ // Generic arguments are found - `<`, `(`, `::<` or `::(`.
2412+ self . eat ( & token:: ModSep ) ;
2413+ let lo = self . span ;
24252414 let args = if self . eat_lt ( ) {
24262415 // `<'a, T, A = U>`
24272416 let ( args, bindings) =
@@ -3043,7 +3032,7 @@ impl<'a> Parser<'a> {
30433032
30443033 // Assuming we have just parsed `.`, continue parsing into an expression.
30453034 fn parse_dot_suffix ( & mut self , self_arg : P < Expr > , lo : Span ) -> PResult < ' a , P < Expr > > {
3046- let segment = self . parse_path_segment ( PathStyle :: Expr , true ) ?;
3035+ let segment = self . parse_path_segment ( PathStyle :: Expr ) ?;
30473036 self . check_trailing_angle_brackets ( & segment, token:: OpenDelim ( token:: Paren ) ) ;
30483037
30493038 Ok ( match self . token {
0 commit comments