@@ -19,7 +19,7 @@ use std::sync::Arc;
1919use std:: { cmp, fmt, iter, mem} ;
2020
2121use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
22- use rustc_data_structures:: sync;
22+ use rustc_data_structures:: sync:: { self , TrArc } ;
2323use rustc_macros:: { Decodable , Encodable , HashStable_Generic , Walkable } ;
2424use rustc_serialize:: { Decodable , Encodable } ;
2525use rustc_span:: { DUMMY_SP , Span , SpanDecoder , SpanEncoder , Symbol , sym} ;
@@ -558,7 +558,7 @@ pub struct AttrsTarget {
558558
559559/// A `TokenStream` is an abstract sequence of tokens, organized into [`TokenTree`]s.
560560#[ derive( Clone , Debug , Default , Encodable , Decodable ) ]
561- pub struct TokenStream ( pub ( crate ) Arc < Vec < TokenTree > > ) ;
561+ pub struct TokenStream ( pub ( crate ) TrArc < Vec < TokenTree > > ) ;
562562
563563/// Indicates whether a token can join with the following token to form a
564564/// compound token. Used for conversions to `proc_macro::Spacing`. Also used to
@@ -675,7 +675,7 @@ impl PartialEq<TokenStream> for TokenStream {
675675
676676impl TokenStream {
677677 pub fn new ( tts : Vec < TokenTree > ) -> TokenStream {
678- TokenStream ( Arc :: new ( tts) )
678+ TokenStream ( TrArc :: new ( tts) )
679679 }
680680
681681 pub fn is_empty ( & self ) -> bool {
@@ -728,7 +728,7 @@ impl TokenStream {
728728 /// Push `tt` onto the end of the stream, possibly gluing it to the last
729729 /// token. Uses `make_mut` to maximize efficiency.
730730 pub fn push_tree ( & mut self , tt : TokenTree ) {
731- let vec_mut = Arc :: make_mut ( & mut self . 0 ) ;
731+ let vec_mut = TrArc :: make_mut ( & mut self . 0 ) ;
732732
733733 if Self :: try_glue_to_last ( vec_mut, & tt) {
734734 // nothing else to do
@@ -741,7 +741,7 @@ impl TokenStream {
741741 /// token tree to the last token. (No other token trees will be glued.)
742742 /// Uses `make_mut` to maximize efficiency.
743743 pub fn push_stream ( & mut self , stream : TokenStream ) {
744- let vec_mut = Arc :: make_mut ( & mut self . 0 ) ;
744+ let vec_mut = TrArc :: make_mut ( & mut self . 0 ) ;
745745
746746 let stream_iter = stream. 0 . iter ( ) . cloned ( ) ;
747747
@@ -761,7 +761,7 @@ impl TokenStream {
761761 }
762762
763763 /// Desugar doc comments like `/// foo` in the stream into `#[doc =
764- /// r"foo"]`. Modifies the `TokenStream` via `Arc ::make_mut`, but as little
764+ /// r"foo"]`. Modifies the `TokenStream` via `TrArc ::make_mut`, but as little
765765 /// as possible.
766766 pub fn desugar_doc_comments ( & mut self ) {
767767 if let Some ( desugared_stream) = desugar_inner ( self . clone ( ) ) {
@@ -780,7 +780,7 @@ impl TokenStream {
780780 ) => {
781781 let desugared = desugared_tts ( attr_style, data, span) ;
782782 let desugared_len = desugared. len ( ) ;
783- Arc :: make_mut ( & mut stream. 0 ) . splice ( i..i + 1 , desugared) ;
783+ TrArc :: make_mut ( & mut stream. 0 ) . splice ( i..i + 1 , desugared) ;
784784 modified = true ;
785785 i += desugared_len;
786786 }
@@ -791,7 +791,7 @@ impl TokenStream {
791791 if let Some ( desugared_delim_stream) = desugar_inner ( delim_stream. clone ( ) ) {
792792 let new_tt =
793793 TokenTree :: Delimited ( sp, spacing, delim, desugared_delim_stream) ;
794- Arc :: make_mut ( & mut stream. 0 ) [ i] = new_tt;
794+ TrArc :: make_mut ( & mut stream. 0 ) [ i] = new_tt;
795795 modified = true ;
796796 }
797797 i += 1 ;
0 commit comments