@@ -42,15 +42,37 @@ mod m {
4242>   ;  ; ` :: ` <sup >?</sup > _ PathExprSegment_ (` :: ` _ PathExprSegment_ )<sup >\* </sup >
4343>
4444> _ PathExprSegment_ :\
45- >   ;  ; _ PathIdentSegment_ (` :: ` [ _ Generics _ ] )<sup >?</sup >
45+ >   ;  ; _ PathIdentSegment_ (` :: ` _ GenericArgs _ )<sup >?</sup >
4646>
4747> _ PathIdentSegment_ :\
4848>   ;  ; [ IDENTIFIER] | ` super ` | ` self ` | ` Self ` | ` $crate `
49+ >
50+ > _ GenericArgs_ :\
51+ >   ;  ;   ;  ; ` < ` ` > ` \
52+ >   ;  ; | ` < ` _ GenericArgsLifetimes_ ` , ` <sup >?</sup > ` > ` \
53+ >   ;  ; | ` < ` _ GenericArgsTypes_ ` , ` <sup >?</sup > ` > ` \
54+ >   ;  ; | ` < ` _ GenericArgsBindings_ ` , ` <sup >?</sup > ` > ` \
55+ >   ;  ; | ` < ` _ GenericArgsTypes_ ` , ` _ GenericArgsBindings_ ` , ` <sup >?</sup > ` > ` \
56+ >   ;  ; | ` < ` _ GenericArgsLifetimes_ ` , ` _ GenericArgsTypes_ ` , ` <sup >?</sup > ` > ` \
57+ >   ;  ; | ` < ` _ GenericArgsLifetimes_ ` , ` _ GenericArgsBindings_ ` , ` <sup >?</sup > ` > ` \
58+ >   ;  ; | ` < ` _ GenericArgsLifetimes_ ` , ` _ GenericArgsTypes_ ` , ` _ GenericArgsBindings_ ` , ` <sup >?</sup > ` > `
59+ >
60+ > _ GenericArgsLifetimes_ :\
61+ >   ;  ; [ _ Lifetime_ ] (` , ` [ _ Lifetime_ ] )<sup >\* </sup >
62+ >
63+ > _ GenericArgsTypes_ :\
64+ >   ;  ; [ _ Type_ ] (` , ` [ _ Type_ ] )<sup >\* </sup >
65+ >
66+ > _ GenericArgsBindings_ :\
67+ >   ;  ; _ GenericArgsBinding_ (` , ` _ GenericArgsBinding_ )<sup >\* </sup >
68+ >
69+ > _ GenericArgsBinding_ :\
70+ >   ;  ; [ IDENTIFIER] ` = ` [ _ Type_ ]
4971
5072Paths in expressions allow for paths with generic arguments to be specified. They are
5173used in various places in [ expressions] and [ patterns] .
5274
53- The ` :: ` token is required before the opening ` < ` for generic parameters to avoid
75+ The ` :: ` token is required before the opening ` < ` for generic arguments to avoid
5476ambiguity with the less-than operator. This is colloquially known as "turbofish" syntax.
5577
5678``` rust
@@ -99,7 +121,7 @@ S::f(); // Calls the inherent impl.
99121>   ;  ; ` :: ` <sup >?</sup > _ TypePathSegment_ (` :: ` _ TypePathSegment_ )<sup >\* </sup >
100122>
101123> _ TypePathSegment_ :\
102- >   ;  ; _ PathIdentSegment_ (` :: ` <sup >?</sup > ([ _ Generics _ ] | _ TypePathFn_ )<sup >?</sup >
124+ >   ;  ; _ PathIdentSegment_ (` :: ` <sup >?</sup > ([ _ GenericArgs _ ] | _ TypePathFn_ )<sup >?</sup >
103125>
104126> _ TypePathFn_ :\
105127> ` ( ` _ TypePathFnInputs_ <sup >?</sup > ` ) ` (` -> ` [ _ Type_ ] )<sup >?</sup >
@@ -110,7 +132,7 @@ S::f(); // Calls the inherent impl.
110132Type paths are used within type definitions, trait bounds, type parameter bounds,
111133and qualified paths.
112134
113- Although the ` :: ` token is allowed before the generics parameters , it is not required
135+ Although the ` :: ` token is allowed before the generics arguments , it is not required
114136because there is no ambiguity like there is in _ PathInExpression_ .
115137
116138``` rust,ignore
@@ -303,15 +325,17 @@ mod without { // ::without
303325
304326# fn main () {}
305327```
328+
329+ [ _GenericArgs_ ] : #paths-in-expressions
330+ [ _Lifetime_ ] : trait-bounds.html
331+ [ _Type_ ] : types.html
306332[ item ] : items.html
307333[ variable ] : variables.html
308334[ identifiers ] : identifiers.html
309335[ implementations ] : items/implementations.html
310336[ modules ] : items/modules.html
311337[ use declarations ] : items/use-declarations.html
312338[ IDENTIFIER ] : identifiers.html
313- [ _Generics_ ] : items/generics.html
314- [ _Type_ ] : types.html
315339[ `use` ] : items/use-declarations.html
316340[ attributes ] : attributes.html
317341[ enum ] : items/enumerations.html
0 commit comments