@@ -46,7 +46,7 @@ use print::pprust;
46
46
use ptr:: P ;
47
47
use parse:: PResult ;
48
48
use ThinVec ;
49
- use tokenstream:: { self , DelimSpan , TokenTree , TokenStream } ;
49
+ use tokenstream:: { self , DelimSpan , TokenTree , TokenStream , TreeAndJoint } ;
50
50
use symbol:: { Symbol , keywords} ;
51
51
52
52
use std:: borrow:: Cow ;
@@ -280,8 +280,8 @@ struct TokenCursorFrame {
280
280
/// on the parser.
281
281
#[ derive( Clone ) ]
282
282
enum LastToken {
283
- Collecting ( Vec < TokenStream > ) ,
284
- Was ( Option < TokenStream > ) ,
283
+ Collecting ( Vec < TreeAndJoint > ) ,
284
+ Was ( Option < TreeAndJoint > ) ,
285
285
}
286
286
287
287
impl TokenCursorFrame {
@@ -7677,7 +7677,7 @@ impl<'a> Parser<'a> {
7677
7677
& mut self . token_cursor . stack [ prev] . last_token
7678
7678
} ;
7679
7679
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.
7681
7681
let mut collected_tokens = match * last_token {
7682
7682
LastToken :: Collecting ( ref mut v) => mem:: replace ( v, Vec :: new ( ) ) ,
7683
7683
LastToken :: Was ( _) => panic ! ( "our vector went away?" ) ,
@@ -7696,10 +7696,9 @@ impl<'a> Parser<'a> {
7696
7696
// call. In that case we need to record all the tokens we collected in
7697
7697
// our parent list as well. To do that we push a clone of our stream
7698
7698
// onto the previous list.
7699
- let stream = collected_tokens. into_iter ( ) . collect :: < TokenStream > ( ) ;
7700
7699
match prev_collecting {
7701
7700
Some ( mut list) => {
7702
- list. push ( stream . clone ( ) ) ;
7701
+ list. extend ( collected_tokens . iter ( ) . cloned ( ) ) ;
7703
7702
list. extend ( extra_token) ;
7704
7703
* last_token = LastToken :: Collecting ( list) ;
7705
7704
}
@@ -7708,7 +7707,7 @@ impl<'a> Parser<'a> {
7708
7707
}
7709
7708
}
7710
7709
7711
- Ok ( ( ret?, stream ) )
7710
+ Ok ( ( ret?, TokenStream :: new ( collected_tokens ) ) )
7712
7711
}
7713
7712
7714
7713
pub fn parse_item ( & mut self ) -> PResult < ' a , Option < P < Item > > > {
0 commit comments