@@ -669,45 +669,22 @@ impl<'a> Parser<'a> {
669669 /// `<` and continue. If a `<` is not seen, return false.
670670 ///
671671 /// This is meant to be used when parsing generics on a path to get the
672- /// starting token. The `force` parameter is used to forcefully break up a
673- /// `<<` token. If `force` is false, then `<<` is only broken when a lifetime
674- /// shows up next. For example, consider the expression:
675- ///
676- /// foo as bar << test
677- ///
678- /// The parser needs to know if `bar <<` is the start of a generic path or if
679- /// it's a left-shift token. If `test` were a lifetime, then it's impossible
680- /// for the token to be a left-shift, but if it's not a lifetime, then it's
681- /// considered a left-shift.
682- ///
683- /// The reason for this is that the only current ambiguity with `<<` is when
684- /// parsing closure types:
685- ///
686- /// foo::<<'a> ||>();
687- /// impl Foo<<'a> ||>() { ... }
688- fn eat_lt ( & mut self , force : bool ) -> bool {
672+ /// starting token.
673+ fn eat_lt ( & mut self ) -> bool {
689674 match self . token {
690675 token:: Lt => { self . bump ( ) ; true }
691676 token:: BinOp ( token:: Shl ) => {
692- let next_lifetime = self . look_ahead ( 1 , |t| match * t {
693- token:: Lifetime ( ..) => true ,
694- _ => false ,
695- } ) ;
696- if force || next_lifetime {
697- let span = self . span ;
698- let lo = span. lo + BytePos ( 1 ) ;
699- self . replace_token ( token:: Lt , lo, span. hi ) ;
700- true
701- } else {
702- false
703- }
677+ let span = self . span ;
678+ let lo = span. lo + BytePos ( 1 ) ;
679+ self . replace_token ( token:: Lt , lo, span. hi ) ;
680+ true
704681 }
705682 _ => false ,
706683 }
707684 }
708685
709686 fn expect_lt ( & mut self ) {
710- if !self . eat_lt ( true ) {
687+ if !self . eat_lt ( ) {
711688 let found_token = self . this_token_to_string ( ) ;
712689 let token_str = Parser :: token_to_string ( & token:: Lt ) ;
713690 self . fatal ( format ! ( "expected `{}`, found `{}`" ,
@@ -1582,9 +1559,8 @@ impl<'a> Parser<'a> {
15821559 TyTypeof ( e)
15831560 } else if self . eat_keyword ( keywords:: Proc ) {
15841561 self . parse_proc_type ( Vec :: new ( ) )
1585- } else if self . check ( & token :: Lt ) {
1562+ } else if self . eat_lt ( ) {
15861563 // QUALIFIED PATH `<TYPE as TRAIT_REF>::item`
1587- self . bump ( ) ;
15881564 let self_type = self . parse_ty_sum ( ) ;
15891565 self . expect_keyword ( keywords:: As ) ;
15901566 let trait_ref = self . parse_trait_ref ( ) ;
@@ -1870,7 +1846,7 @@ impl<'a> Parser<'a> {
18701846 let identifier = self . parse_ident ( ) ;
18711847
18721848 // Parse types, optionally.
1873- let parameters = if self . eat_lt ( false ) {
1849+ let parameters = if self . eat_lt ( ) {
18741850 let ( lifetimes, types, bindings) = self . parse_generic_values_after_lt ( ) ;
18751851
18761852 ast:: AngleBracketedParameters ( ast:: AngleBracketedParameterData {
@@ -1931,7 +1907,7 @@ impl<'a> Parser<'a> {
19311907 }
19321908
19331909 // Check for a type segment.
1934- if self . eat_lt ( false ) {
1910+ if self . eat_lt ( ) {
19351911 // Consumed `a::b::<`, go look for types
19361912 let ( lifetimes, types, bindings) = self . parse_generic_values_after_lt ( ) ;
19371913 segments. push ( ast:: PathSegment {
0 commit comments