1414//! ownership of the original.
1515
1616use std:: borrow:: Cow ;
17+ use std:: sync:: Arc ;
1718use std:: { cmp, fmt, iter} ;
1819
1920use rustc_data_structures:: stable_hasher:: { HashStable , StableHasher } ;
20- use rustc_data_structures:: sync:: { self , Lrc } ;
21+ use rustc_data_structures:: sync;
2122use rustc_macros:: { Decodable , Encodable , HashStable_Generic } ;
2223use rustc_serialize:: { Decodable , Encodable } ;
2324use rustc_span:: { DUMMY_SP , Span , SpanDecoder , SpanEncoder , Symbol , sym} ;
@@ -119,11 +120,11 @@ impl ToAttrTokenStream for AttrTokenStream {
119120/// of an actual `TokenStream` until it is needed.
120121/// `Box` is here only to reduce the structure size.
121122#[ derive( Clone ) ]
122- pub struct LazyAttrTokenStream ( Lrc < Box < dyn ToAttrTokenStream > > ) ;
123+ pub struct LazyAttrTokenStream ( Arc < Box < dyn ToAttrTokenStream > > ) ;
123124
124125impl LazyAttrTokenStream {
125126 pub fn new ( inner : impl ToAttrTokenStream + ' static ) -> LazyAttrTokenStream {
126- LazyAttrTokenStream ( Lrc :: new ( Box :: new ( inner) ) )
127+ LazyAttrTokenStream ( Arc :: new ( Box :: new ( inner) ) )
127128 }
128129
129130 pub fn to_attr_token_stream ( & self ) -> AttrTokenStream {
@@ -160,7 +161,7 @@ impl<CTX> HashStable<CTX> for LazyAttrTokenStream {
160161/// during expansion to perform early cfg-expansion, and to process attributes
161162/// during proc-macro invocations.
162163#[ derive( Clone , Debug , Default , Encodable , Decodable ) ]
163- pub struct AttrTokenStream ( pub Lrc < Vec < AttrTokenTree > > ) ;
164+ pub struct AttrTokenStream ( pub Arc < Vec < AttrTokenTree > > ) ;
164165
165166/// Like `TokenTree`, but for `AttrTokenStream`.
166167#[ derive( Clone , Debug , Encodable , Decodable ) ]
@@ -175,7 +176,7 @@ pub enum AttrTokenTree {
175176
176177impl AttrTokenStream {
177178 pub fn new ( tokens : Vec < AttrTokenTree > ) -> AttrTokenStream {
178- AttrTokenStream ( Lrc :: new ( tokens) )
179+ AttrTokenStream ( Arc :: new ( tokens) )
179180 }
180181
181182 /// Converts this `AttrTokenStream` to a plain `Vec<TokenTree>`. During
@@ -293,7 +294,7 @@ pub struct AttrsTarget {
293294/// Today's `TokenTree`s can still contain AST via `token::Interpolated` for
294295/// backwards compatibility.
295296#[ derive( Clone , Debug , Default , Encodable , Decodable ) ]
296- pub struct TokenStream ( pub ( crate ) Lrc < Vec < TokenTree > > ) ;
297+ pub struct TokenStream ( pub ( crate ) Arc < Vec < TokenTree > > ) ;
297298
298299/// Indicates whether a token can join with the following token to form a
299300/// compound token. Used for conversions to `proc_macro::Spacing`. Also used to
@@ -412,7 +413,7 @@ impl PartialEq<TokenStream> for TokenStream {
412413
413414impl TokenStream {
414415 pub fn new ( tts : Vec < TokenTree > ) -> TokenStream {
415- TokenStream ( Lrc :: new ( tts) )
416+ TokenStream ( Arc :: new ( tts) )
416417 }
417418
418419 pub fn is_empty ( & self ) -> bool {
@@ -544,7 +545,7 @@ impl TokenStream {
544545 /// Push `tt` onto the end of the stream, possibly gluing it to the last
545546 /// token. Uses `make_mut` to maximize efficiency.
546547 pub fn push_tree ( & mut self , tt : TokenTree ) {
547- let vec_mut = Lrc :: make_mut ( & mut self . 0 ) ;
548+ let vec_mut = Arc :: make_mut ( & mut self . 0 ) ;
548549
549550 if Self :: try_glue_to_last ( vec_mut, & tt) {
550551 // nothing else to do
@@ -557,7 +558,7 @@ impl TokenStream {
557558 /// token tree to the last token. (No other token trees will be glued.)
558559 /// Uses `make_mut` to maximize efficiency.
559560 pub fn push_stream ( & mut self , stream : TokenStream ) {
560- let vec_mut = Lrc :: make_mut ( & mut self . 0 ) ;
561+ let vec_mut = Arc :: make_mut ( & mut self . 0 ) ;
561562
562563 let stream_iter = stream. 0 . iter ( ) . cloned ( ) ;
563564
@@ -577,7 +578,7 @@ impl TokenStream {
577578 }
578579
579580 /// Desugar doc comments like `/// foo` in the stream into `#[doc =
580- /// r"foo"]`. Modifies the `TokenStream` via `Lrc ::make_mut`, but as little
581+ /// r"foo"]`. Modifies the `TokenStream` via `Arc ::make_mut`, but as little
581582 /// as possible.
582583 pub fn desugar_doc_comments ( & mut self ) {
583584 if let Some ( desugared_stream) = desugar_inner ( self . clone ( ) ) {
@@ -596,7 +597,7 @@ impl TokenStream {
596597 ) => {
597598 let desugared = desugared_tts ( attr_style, data, span) ;
598599 let desugared_len = desugared. len ( ) ;
599- Lrc :: make_mut ( & mut stream. 0 ) . splice ( i..i + 1 , desugared) ;
600+ Arc :: make_mut ( & mut stream. 0 ) . splice ( i..i + 1 , desugared) ;
600601 modified = true ;
601602 i += desugared_len;
602603 }
@@ -607,7 +608,7 @@ impl TokenStream {
607608 if let Some ( desugared_delim_stream) = desugar_inner ( delim_stream. clone ( ) ) {
608609 let new_tt =
609610 TokenTree :: Delimited ( sp, spacing, delim, desugared_delim_stream) ;
610- Lrc :: make_mut ( & mut stream. 0 ) [ i] = new_tt;
611+ Arc :: make_mut ( & mut stream. 0 ) [ i] = new_tt;
611612 modified = true ;
612613 }
613614 i += 1 ;
0 commit comments