@@ -46,7 +46,7 @@ use print::pprust;
4646use ptr:: P ;
4747use parse:: PResult ;
4848use ThinVec ;
49- use tokenstream:: { self , DelimSpan , TokenTree , TokenStream } ;
49+ use tokenstream:: { self , DelimSpan , TokenTree , TokenStream , TreeAndJoint } ;
5050use symbol:: { Symbol , keywords} ;
5151
5252use std:: borrow:: Cow ;
@@ -280,8 +280,8 @@ struct TokenCursorFrame {
280280/// on the parser.
281281#[ derive( Clone ) ]
282282enum LastToken {
283- Collecting ( Vec < TokenStream > ) ,
284- Was ( Option < TokenStream > ) ,
283+ Collecting ( Vec < TreeAndJoint > ) ,
284+ Was ( Option < TreeAndJoint > ) ,
285285}
286286
287287impl TokenCursorFrame {
@@ -7677,7 +7677,7 @@ impl<'a> Parser<'a> {
76777677 & mut self . token_cursor . stack [ prev] . last_token
76787678 } ;
76797679
7680- // Pull our the toekns that we've collected from the call to `f` above
7680+ // Pull out the tokens that we've collected from the call to `f` above.
76817681 let mut collected_tokens = match * last_token {
76827682 LastToken :: Collecting ( ref mut v) => mem:: replace ( v, Vec :: new ( ) ) ,
76837683 LastToken :: Was ( _) => panic ! ( "our vector went away?" ) ,
@@ -7696,10 +7696,9 @@ impl<'a> Parser<'a> {
76967696 // call. In that case we need to record all the tokens we collected in
76977697 // our parent list as well. To do that we push a clone of our stream
76987698 // onto the previous list.
7699- let stream = collected_tokens. into_iter ( ) . collect :: < TokenStream > ( ) ;
77007699 match prev_collecting {
77017700 Some ( mut list) => {
7702- list. push ( stream . clone ( ) ) ;
7701+ list. extend ( collected_tokens . iter ( ) . cloned ( ) ) ;
77037702 list. extend ( extra_token) ;
77047703 * last_token = LastToken :: Collecting ( list) ;
77057704 }
@@ -7708,7 +7707,7 @@ impl<'a> Parser<'a> {
77087707 }
77097708 }
77107709
7711- Ok ( ( ret?, stream ) )
7710+ Ok ( ( ret?, TokenStream :: new ( collected_tokens ) ) )
77127711 }
77137712
77147713 pub fn parse_item ( & mut self ) -> PResult < ' a , Option < P < Item > > > {
0 commit comments