@@ -1903,7 +1903,7 @@ impl<'a> Parser<'a> {
1903
1903
self . expect ( & token:: ModSep ) ?;
1904
1904
1905
1905
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 ) ?;
1907
1907
path. span = ty_span. to ( self . prev_span ) ;
1908
1908
1909
1909
let ty_str = self . sess . source_map ( ) . span_to_snippet ( ty_span)
@@ -2294,7 +2294,7 @@ impl<'a> Parser<'a> {
2294
2294
self . expect ( & token:: ModSep ) ?;
2295
2295
2296
2296
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) ?;
2298
2298
2299
2299
Ok ( ( qself, ast:: Path { segments : path. segments , span : lo. to ( self . prev_span ) } ) )
2300
2300
}
@@ -2310,11 +2310,6 @@ impl<'a> Parser<'a> {
2310
2310
/// `Fn(Args)` (without disambiguator)
2311
2311
/// `Fn::(Args)` (with disambiguator)
2312
2312
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 > {
2318
2313
maybe_whole ! ( self , NtPath , |path| {
2319
2314
if style == PathStyle :: Mod &&
2320
2315
path. segments. iter( ) . any( |segment| segment. args. is_some( ) ) {
@@ -2329,7 +2324,7 @@ impl<'a> Parser<'a> {
2329
2324
if self . eat ( & token:: ModSep ) {
2330
2325
segments. push ( PathSegment :: path_root ( lo. shrink_to_lo ( ) . with_ctxt ( mod_sep_ctxt) ) ) ;
2331
2326
}
2332
- self . parse_path_segments ( & mut segments, style, enable_warning ) ?;
2327
+ self . parse_path_segments ( & mut segments, style) ?;
2333
2328
2334
2329
Ok ( ast:: Path { segments, span : lo. to ( self . prev_span ) } )
2335
2330
}
@@ -2357,11 +2352,10 @@ impl<'a> Parser<'a> {
2357
2352
2358
2353
fn parse_path_segments ( & mut self ,
2359
2354
segments : & mut Vec < PathSegment > ,
2360
- style : PathStyle ,
2361
- enable_warning : bool )
2355
+ style : PathStyle )
2362
2356
-> PResult < ' a , ( ) > {
2363
2357
loop {
2364
- let segment = self . parse_path_segment ( style, enable_warning ) ?;
2358
+ let segment = self . parse_path_segment ( style) ?;
2365
2359
if style == PathStyle :: Expr {
2366
2360
// In order to check for trailing angle brackets, we must have finished
2367
2361
// recursing (`parse_path_segment` can indirectly call this function),
@@ -2389,8 +2383,7 @@ impl<'a> Parser<'a> {
2389
2383
}
2390
2384
}
2391
2385
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 > {
2394
2387
let ident = self . parse_path_segment_ident ( ) ?;
2395
2388
2396
2389
let is_args_start = |token : & token:: Token | match * token {
@@ -2407,13 +2400,6 @@ impl<'a> Parser<'a> {
2407
2400
Ok ( if style == PathStyle :: Type && check_args_start ( self ) ||
2408
2401
style != PathStyle :: Mod && self . check ( & token:: ModSep )
2409
2402
&& 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
-
2417
2403
// We use `style == PathStyle::Expr` to check if this is in a recursion or not. If
2418
2404
// it isn't, then we reset the unmatched angle bracket count as we're about to start
2419
2405
// parsing a new path.
@@ -2422,6 +2408,9 @@ impl<'a> Parser<'a> {
2422
2408
self . max_angle_bracket_count = 0 ;
2423
2409
}
2424
2410
2411
+ // Generic arguments are found - `<`, `(`, `::<` or `::(`.
2412
+ self . eat ( & token:: ModSep ) ;
2413
+ let lo = self . span ;
2425
2414
let args = if self . eat_lt ( ) {
2426
2415
// `<'a, T, A = U>`
2427
2416
let ( args, bindings) =
@@ -3043,7 +3032,7 @@ impl<'a> Parser<'a> {
3043
3032
3044
3033
// Assuming we have just parsed `.`, continue parsing into an expression.
3045
3034
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 ) ?;
3047
3036
self . check_trailing_angle_brackets ( & segment, token:: OpenDelim ( token:: Paren ) ) ;
3048
3037
3049
3038
Ok ( match self . token {
0 commit comments