@@ -25,7 +25,7 @@ use ast::{ExprAssign, ExprAssignOp, ExprBinary, ExprBlock, ExprBox};
25
25
use ast:: { ExprBreak , ExprCall , ExprCast } ;
26
26
use ast:: { ExprField , ExprTupField , ExprClosure , ExprIf , ExprIfLet , ExprIndex } ;
27
27
use ast:: { ExprLit , ExprLoop , ExprMac , ExprRange } ;
28
- use ast:: { ExprMethodCall , ExprParen , ExprPath } ;
28
+ use ast:: { ExprMethodCall , ExprParen , ExprPath , ExprQPath } ;
29
29
use ast:: { ExprRepeat , ExprRet , ExprStruct , ExprTup , ExprUnary } ;
30
30
use ast:: { ExprVec , ExprWhile , ExprWhileLet , ExprForLoop , Field , FnDecl } ;
31
31
use ast:: { FnUnboxedClosureKind , FnMutUnboxedClosureKind } ;
@@ -1573,7 +1573,10 @@ impl<'a> Parser<'a> {
1573
1573
TyQPath ( P ( QPath {
1574
1574
self_type : self_type,
1575
1575
trait_ref : P ( trait_ref) ,
1576
- item_name : item_name,
1576
+ item_path : ast:: PathSegment {
1577
+ identifier : item_name,
1578
+ parameters : ast:: PathParameters :: none ( )
1579
+ }
1577
1580
} ) )
1578
1581
} else if self . check ( & token:: ModSep ) ||
1579
1582
self . token . is_ident ( ) ||
@@ -1894,11 +1897,7 @@ impl<'a> Parser<'a> {
1894
1897
if !self . eat ( & token:: ModSep ) {
1895
1898
segments. push ( ast:: PathSegment {
1896
1899
identifier : identifier,
1897
- parameters : ast:: AngleBracketedParameters ( ast:: AngleBracketedParameterData {
1898
- lifetimes : Vec :: new ( ) ,
1899
- types : OwnedSlice :: empty ( ) ,
1900
- bindings : OwnedSlice :: empty ( ) ,
1901
- } )
1900
+ parameters : ast:: PathParameters :: none ( )
1902
1901
} ) ;
1903
1902
return segments;
1904
1903
}
@@ -2253,6 +2252,37 @@ impl<'a> Parser<'a> {
2253
2252
hi = self . last_span . hi ;
2254
2253
}
2255
2254
_ => {
2255
+ if self . eat_lt ( ) {
2256
+ // QUALIFIED PATH `<TYPE as TRAIT_REF>::item::<'a, T>`
2257
+ let self_type = self . parse_ty_sum ( ) ;
2258
+ self . expect_keyword ( keywords:: As ) ;
2259
+ let trait_ref = self . parse_trait_ref ( ) ;
2260
+ self . expect ( & token:: Gt ) ;
2261
+ self . expect ( & token:: ModSep ) ;
2262
+ let item_name = self . parse_ident ( ) ;
2263
+ let parameters = if self . eat ( & token:: ModSep ) {
2264
+ self . expect_lt ( ) ;
2265
+ // Consumed `item::<`, go look for types
2266
+ let ( lifetimes, types, bindings) =
2267
+ self . parse_generic_values_after_lt ( ) ;
2268
+ ast:: AngleBracketedParameters ( ast:: AngleBracketedParameterData {
2269
+ lifetimes : lifetimes,
2270
+ types : OwnedSlice :: from_vec ( types) ,
2271
+ bindings : OwnedSlice :: from_vec ( bindings) ,
2272
+ } )
2273
+ } else {
2274
+ ast:: PathParameters :: none ( )
2275
+ } ;
2276
+ let hi = self . span . hi ;
2277
+ return self . mk_expr ( lo, hi, ExprQPath ( P ( QPath {
2278
+ self_type : self_type,
2279
+ trait_ref : P ( trait_ref) ,
2280
+ item_path : ast:: PathSegment {
2281
+ identifier : item_name,
2282
+ parameters : parameters
2283
+ }
2284
+ } ) ) ) ;
2285
+ }
2256
2286
if self . eat_keyword ( keywords:: Move ) {
2257
2287
return self . parse_lambda_expr ( CaptureByValue ) ;
2258
2288
}
0 commit comments