@@ -62,10 +62,17 @@ Vec::<u8>::with_capacity(1024);
62
62
63
63
> ** <sup >Syntax</sup >** \
64
64
> _ QualifiedPathInExpression_ :\
65
- >   ;  ; ` < ` [ _ Type_ ] (` as ` _ TypePath_ )? ` > ` (` :: ` _ PathExprSegment_ )<sup >\* </sup >
65
+ >   ;  ; _ QualifiedPathType_ (` :: ` _ PathExprSegment_ )<sup >\* </sup >
66
+ >
67
+ > _ QualifiedPathType_ :\
68
+ >   ;  ; ` < ` [ _ Type_ ] (` as ` _ TypePath_ )? ` > `
69
+ >
70
+ > _ QualifiedPathInType_ :\
71
+ >   ;  ; _ QualifiedPathType_ (` :: ` _ TypePathSegment_ )<sup >\* </sup >
66
72
67
- Fully qualified paths allow for disambiguating the path for [ trait implementations] and for
68
- specifying [ canonical paths] ( #canonical-paths ) .
73
+ Fully qualified paths allow for disambiguating the path for [ trait implementations] and
74
+ for specifying [ canonical paths] ( #canonical-paths ) . When used in a type specification, it
75
+ supports using the type syntax specified below.
69
76
70
77
``` rust
71
78
struct S ;
@@ -92,17 +99,24 @@ S::f(); // Calls the inherent impl.
92
99
>   ;  ; ` :: ` <sup >?</sup > _ TypePathSegment_ (` :: ` _ TypePathSegment_ )<sup >\* </sup >
93
100
>
94
101
> _ TypePathSegment_ :\
95
- >   ;  ; _ PathIdentSegment_ (` :: ` <sup >?</sup > [ _ Generics_ ] )<sup >?</sup >
102
+ >   ;  ; _ PathIdentSegment_ (` :: ` <sup >?</sup > ([ _ Generics_ ] | _ TypePathFn_ )<sup >?</sup >
103
+ >
104
+ > _ TypePathFn_ :\
105
+ > ` ( ` _ TypePathFnInputs_ <sup >?</sup > ` ) ` (` -> ` [ _ Type_ ] )<sup >?</sup >
106
+ >
107
+ > _ TypePathFnInputs_ :\
108
+ > [ _ Type_ ] (` , ` [ _ Type_ ] )<sup >\* </sup > ` , ` <sup >?</sup >
96
109
97
110
Type paths are used within type definitions, trait bounds, type parameter bounds,
98
- and qualified paths in expressions .
111
+ and qualified paths.
99
112
100
113
Although the ` :: ` token is allowed before the generics parameters, it is not required
101
114
because there is no ambiguity like there is in _ PathInExpression_ .
102
115
103
116
``` rust,ignore
104
117
impl ops::Index<ops::Range<usize>> for S { /*...*/ }
105
118
fn i() -> impl Iterator<Item = op::Example<'a>> { /*...*/ }
119
+ type G = std::boxed::Box<std::ops::FnOnce(isize) -> isize>;
106
120
```
107
121
108
122
## Path qualifiers
0 commit comments