Skip to content

Commit 9811a3a

Browse files
committed
Auto merge of #14718 - lnicola:triomphe, r=Veykril
internal: Use `triomphe::Arc` Closes #14717
2 parents a7168a8 + 7197a27 commit 9811a3a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+337
-263
lines changed

Cargo.lock

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,4 @@ smol_str = "0.2.0"
8181
# the following crates are pinned to prevent us from pulling in syn 2 until all our dependencies have moved
8282
serde = { version = "=1.0.156", features = ["derive"] }
8383
serde_json = "1.0.94"
84+
triomphe = { version = "0.1.8", default-features = false, features = ["std"] }

crates/base-db/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ doctest = false
1515
salsa = "0.17.0-pre.2"
1616
rustc-hash = "1.1.0"
1717

18+
triomphe.workspace = true
19+
1820
la-arena = { version = "0.3.0", path = "../../lib/la-arena" }
1921

2022
# local deps

crates/base-db/src/change.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
//! Defines a unit of change that can applied to the database to get the next
22
//! state. Changes are transactional.
33
4-
use std::{fmt, sync::Arc};
4+
use std::fmt;
55

66
use salsa::Durability;
7+
use triomphe::Arc;
78
use vfs::FileId;
89

910
use crate::{CrateGraph, ProcMacros, SourceDatabaseExt, SourceRoot, SourceRootId};

crates/base-db/src/fixture.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
//! A set of high-level utility fixture methods to use in tests.
2-
use std::{mem, str::FromStr, sync::Arc};
2+
use std::{mem, str::FromStr, sync};
33

44
use cfg::CfgOptions;
55
use rustc_hash::FxHashMap;
66
use test_utils::{
77
extract_range_or_offset, Fixture, FixtureWithProjectMeta, RangeOrOffset, CURSOR_MARKER,
88
ESCAPED_CURSOR_MARKER,
99
};
10+
use triomphe::Arc;
1011
use tt::token_id::{Leaf, Subtree, TokenTree};
1112
use vfs::{file_set::FileSet, VfsPath};
1213

@@ -334,7 +335,7 @@ pub fn identity(_attr: TokenStream, item: TokenStream) -> TokenStream {
334335
ProcMacro {
335336
name: "identity".into(),
336337
kind: crate::ProcMacroKind::Attr,
337-
expander: Arc::new(IdentityProcMacroExpander),
338+
expander: sync::Arc::new(IdentityProcMacroExpander),
338339
},
339340
),
340341
(
@@ -348,7 +349,7 @@ pub fn derive_identity(item: TokenStream) -> TokenStream {
348349
ProcMacro {
349350
name: "DeriveIdentity".into(),
350351
kind: crate::ProcMacroKind::CustomDerive,
351-
expander: Arc::new(IdentityProcMacroExpander),
352+
expander: sync::Arc::new(IdentityProcMacroExpander),
352353
},
353354
),
354355
(
@@ -362,7 +363,7 @@ pub fn input_replace(attr: TokenStream, _item: TokenStream) -> TokenStream {
362363
ProcMacro {
363364
name: "input_replace".into(),
364365
kind: crate::ProcMacroKind::Attr,
365-
expander: Arc::new(AttributeInputReplaceProcMacroExpander),
366+
expander: sync::Arc::new(AttributeInputReplaceProcMacroExpander),
366367
},
367368
),
368369
(
@@ -376,7 +377,7 @@ pub fn mirror(input: TokenStream) -> TokenStream {
376377
ProcMacro {
377378
name: "mirror".into(),
378379
kind: crate::ProcMacroKind::FuncLike,
379-
expander: Arc::new(MirrorProcMacroExpander),
380+
expander: sync::Arc::new(MirrorProcMacroExpander),
380381
},
381382
),
382383
(
@@ -390,7 +391,7 @@ pub fn shorten(input: TokenStream) -> TokenStream {
390391
ProcMacro {
391392
name: "shorten".into(),
392393
kind: crate::ProcMacroKind::FuncLike,
393-
expander: Arc::new(ShortenProcMacroExpander),
394+
expander: sync::Arc::new(ShortenProcMacroExpander),
394395
},
395396
),
396397
]

crates/base-db/src/input.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
//! actual IO. See `vfs` and `project_model` in the `rust-analyzer` crate for how
77
//! actual IO is done and lowered to input.
88
9-
use std::{fmt, mem, ops, panic::RefUnwindSafe, str::FromStr, sync::Arc};
9+
use std::{fmt, mem, ops, panic::RefUnwindSafe, str::FromStr, sync};
1010

1111
use cfg::CfgOptions;
1212
use la_arena::{Arena, Idx};
1313
use rustc_hash::{FxHashMap, FxHashSet};
1414
use syntax::SmolStr;
15+
use triomphe::Arc;
1516
use tt::token_id::Subtree;
1617
use vfs::{file_set::FileSet, AbsPathBuf, AnchoredPath, FileId, VfsPath};
1718

@@ -263,7 +264,7 @@ pub type TargetLayoutLoadResult = Result<Arc<str>, Arc<str>>;
263264
pub struct ProcMacro {
264265
pub name: SmolStr,
265266
pub kind: ProcMacroKind,
266-
pub expander: Arc<dyn ProcMacroExpander>,
267+
pub expander: sync::Arc<dyn ProcMacroExpander>,
267268
}
268269

269270
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]

crates/base-db/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ mod input;
66
mod change;
77
pub mod fixture;
88

9-
use std::{panic, sync::Arc};
9+
use std::panic;
1010

1111
use rustc_hash::FxHashSet;
1212
use syntax::{ast, Parse, SourceFile, TextRange, TextSize};
13+
use triomphe::Arc;
1314

1415
pub use crate::{
1516
change::Change,

crates/hir-def/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ once_cell = "1.17.0"
2929
rustc-hash = "1.1.0"
3030
smallvec.workspace = true
3131
tracing = "0.1.35"
32+
triomphe.workspace = true
3233

3334
rustc_abi = { version = "0.0.20221221", package = "hkalbasi-rustc-ap-rustc_abi", default-features = false }
3435
rustc_index = { version = "0.0.20221221", package = "hkalbasi-rustc-ap-rustc_index", default-features = false }

crates/hir-def/src/attr.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub mod builtin;
55
#[cfg(test)]
66
mod tests;
77

8-
use std::{hash::Hash, ops, sync::Arc};
8+
use std::{hash::Hash, ops};
99

1010
use base_db::CrateId;
1111
use cfg::{CfgExpr, CfgOptions};
@@ -21,6 +21,7 @@ use syntax::{
2121
ast::{self, HasAttrs, IsString},
2222
AstPtr, AstToken, SmolStr, TextRange, TextSize,
2323
};
24+
use triomphe::Arc;
2425

2526
use crate::{
2627
db::DefDatabase,

crates/hir-def/src/body.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod tests;
66
pub mod scope;
77
mod pretty;
88

9-
use std::{ops::Index, sync::Arc};
9+
use std::ops::Index;
1010

1111
use base_db::CrateId;
1212
use cfg::{CfgExpr, CfgOptions};
@@ -16,6 +16,7 @@ use la_arena::{Arena, ArenaMap};
1616
use profile::Count;
1717
use rustc_hash::FxHashMap;
1818
use syntax::{ast, AstPtr, SyntaxNodePtr};
19+
use triomphe::Arc;
1920

2021
use crate::{
2122
db::DefDatabase,

0 commit comments

Comments
 (0)