@@ -62,10 +62,17 @@ Vec::<u8>::with_capacity(1024);
6262
6363> ** <sup >Syntax</sup >** \
6464> _ 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 >
6672
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.
6976
7077``` rust
7178struct S ;
@@ -92,17 +99,24 @@ S::f(); // Calls the inherent impl.
9299>   ;  ; ` :: ` <sup >?</sup > _ TypePathSegment_ (` :: ` _ TypePathSegment_ )<sup >\* </sup >
93100>
94101> _ 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 >
96109
97110Type paths are used within type definitions, trait bounds, type parameter bounds,
98- and qualified paths in expressions .
111+ and qualified paths.
99112
100113Although the ` :: ` token is allowed before the generics parameters, it is not required
101114because there is no ambiguity like there is in _ PathInExpression_ .
102115
103116``` rust,ignore
104117impl ops::Index<ops::Range<usize>> for S { /*...*/ }
105118fn i() -> impl Iterator<Item = op::Example<'a>> { /*...*/ }
119+ type G = std::boxed::Box<std::ops::FnOnce(isize) -> isize>;
106120```
107121
108122## Path qualifiers
0 commit comments