@@ -25,7 +25,7 @@ use ast::{ExprAssign, ExprAssignOp, ExprBinary, ExprBlock, ExprBox};
2525use ast:: { ExprBreak , ExprCall , ExprCast } ;
2626use ast:: { ExprField , ExprTupField , ExprClosure , ExprIf , ExprIfLet , ExprIndex } ;
2727use ast:: { ExprLit , ExprLoop , ExprMac , ExprRange } ;
28- use ast:: { ExprMethodCall , ExprParen , ExprPath } ;
28+ use ast:: { ExprMethodCall , ExprParen , ExprPath , ExprQPath } ;
2929use ast:: { ExprRepeat , ExprRet , ExprStruct , ExprTup , ExprUnary } ;
3030use ast:: { ExprVec , ExprWhile , ExprWhileLet , ExprForLoop , Field , FnDecl } ;
3131use ast:: { FnUnboxedClosureKind , FnMutUnboxedClosureKind } ;
@@ -1573,7 +1573,10 @@ impl<'a> Parser<'a> {
15731573 TyQPath ( P ( QPath {
15741574 self_type : self_type,
15751575 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+ }
15771580 } ) )
15781581 } else if self . check ( & token:: ModSep ) ||
15791582 self . token . is_ident ( ) ||
@@ -1894,11 +1897,7 @@ impl<'a> Parser<'a> {
18941897 if !self . eat ( & token:: ModSep ) {
18951898 segments. push ( ast:: PathSegment {
18961899 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 ( )
19021901 } ) ;
19031902 return segments;
19041903 }
@@ -2253,6 +2252,37 @@ impl<'a> Parser<'a> {
22532252 hi = self . last_span . hi ;
22542253 }
22552254 _ => {
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+ }
22562286 if self . eat_keyword ( keywords:: Move ) {
22572287 return self . parse_lambda_expr ( CaptureByValue ) ;
22582288 }
0 commit comments