Skip to content

Commit 805f74a

Browse files
committed
how much would Arc cost?
1 parent fe0c06d commit 805f74a

5 files changed

Lines changed: 7 additions & 8 deletions

File tree

compiler/rustc_expand/src/proc_macro_server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::ops::{Bound, Range};
2-
use std::rc::Rc;
2+
use std::sync::Arc;
33

44
use ast::token::IdentIsRaw;
55
use rustc_ast as ast;
@@ -365,7 +365,7 @@ impl<'a, 'b> Rustc<'a, 'b> {
365365
pub(crate) fn ts_pm_to_rustc(&mut self, ts: BridgeTokenStream) -> tokenstream::TokenStream {
366366
let mut t = tokenstream::TokenStream::new(vec![]);
367367

368-
for tree in Rc::into_inner(ts.trees).expect("just decoded this `Rc`") {
368+
for tree in Arc::into_inner(ts.trees).expect("just decoded this `Arc`") {
369369
use rustc_ast::token::*;
370370

371371
// The code below is conservative, using `token_alone`/`Spacing::Alone`

library/proc_macro/src/bridge/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
33
use std::cell::RefCell;
44
use std::marker::PhantomData;
5-
use std::rc::Rc;
5+
use std::sync::Arc as Rc;
66
use std::sync::atomic::AtomicU32;
77

88
use super::*;

library/proc_macro/src/bridge/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010

1111
use std::hash::Hash;
1212
use std::ops::{Bound, Range};
13-
use std::rc::Rc;
14-
use std::sync::Once;
13+
use std::sync::{Arc as Rc, Once};
1514
use std::{fmt, marker, panic, thread};
1615

1716
use crate::{Delimiter, Level};

library/proc_macro/src/bridge/rpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::any::Any;
44
use std::io::Write;
55
use std::num::NonZero;
6-
use std::rc::Rc;
6+
use std::sync::Arc as Rc;
77

88
use super::buffer::Buffer;
99

library/proc_macro/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ use core::ops::BitOr;
4747
use std::ffi::CStr;
4848
use std::ops::{Range, RangeBounds};
4949
use std::path::PathBuf;
50-
use std::rc::Rc;
5150
use std::str::FromStr;
51+
use std::sync::Arc as Rc;
5252
use std::{error, fmt};
5353

5454
#[unstable(feature = "proc_macro_diagnostic", issue = "54140")]
@@ -378,7 +378,7 @@ extend_items!(Group Literal Punct Ident);
378378
/// Public implementation details for the `TokenStream` type, such as iterators.
379379
#[stable(feature = "proc_macro_lib2", since = "1.29.0")]
380380
pub mod token_stream {
381-
use std::rc::Rc;
381+
use std::sync::Arc as Rc;
382382

383383
use crate::{Group, Ident, Literal, Punct, TokenStream, TokenTree, bridge};
384384

0 commit comments

Comments
 (0)