diff options
| author | bors <bors@rust-lang.org> | 2025-02-06 10:50:05 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-02-06 10:50:05 +0000 |
| commit | 2f92f050e83bf3312ce4ba73c31fe843ad3cbc60 (patch) | |
| tree | ce6f75039ccafd2fa1dd5dbdeeff37233cb09d45 /compiler/rustc_middle/src/traits/mod.rs | |
| parent | 59588250ad973ce69bd15879314c9769e65f36b3 (diff) | |
| parent | 0a21f1d0a2fe9e84727a2de735fdcf55e8820db6 (diff) | |
| download | rust-2f92f050e83bf3312ce4ba73c31fe843ad3cbc60.tar.gz rust-2f92f050e83bf3312ce4ba73c31fe843ad3cbc60.zip | |
Auto merge of #136471 - safinaskar:parallel, r=SparrowLii
tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc`
tree-wide: parallel: Fully removed all `Lrc`, replaced with `Arc`
This is continuation of https://github.com/rust-lang/rust/pull/132282 .
I'm pretty sure I did everything right. In particular, I searched all occurrences of `Lrc` in submodules and made sure that they don't need replacement.
There are other possibilities, through.
We can define `enum Lrc<T> { Rc(Rc<T>), Arc(Arc<T>) }`. Or we can make `Lrc` a union and on every clone we can read from special thread-local variable. Or we can add a generic parameter to `Lrc` and, yes, this parameter will be everywhere across all codebase.
So, if you think we should take some alternative approach, then don't merge this PR. But if it is decided to stick with `Arc`, then, please, merge.
cc "Parallel Rustc Front-end" ( https://github.com/rust-lang/rust/issues/113349 )
r? SparrowLii
`@rustbot` label WG-compiler-parallel
Diffstat (limited to 'compiler/rustc_middle/src/traits/mod.rs')
| -rw-r--r-- | compiler/rustc_middle/src/traits/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_middle/src/traits/mod.rs b/compiler/rustc_middle/src/traits/mod.rs index 1314a235610..f039da772fd 100644 --- a/compiler/rustc_middle/src/traits/mod.rs +++ b/compiler/rustc_middle/src/traits/mod.rs @@ -10,8 +10,8 @@ mod structural_impls; use std::borrow::Cow; use std::hash::{Hash, Hasher}; +use std::sync::Arc; -use rustc_data_structures::sync::Lrc; use rustc_errors::{Applicability, Diag, EmissionGuarantee}; use rustc_hir as hir; use rustc_hir::HirId; @@ -157,7 +157,7 @@ pub struct UnifyReceiverContext<'tcx> { pub struct InternedObligationCauseCode<'tcx> { /// `None` for `ObligationCauseCode::Misc` (a common case, occurs ~60% of /// the time). `Some` otherwise. - code: Option<Lrc<ObligationCauseCode<'tcx>>>, + code: Option<Arc<ObligationCauseCode<'tcx>>>, } impl<'tcx> std::fmt::Debug for InternedObligationCauseCode<'tcx> { @@ -171,7 +171,7 @@ impl<'tcx> ObligationCauseCode<'tcx> { #[inline(always)] fn into(self) -> InternedObligationCauseCode<'tcx> { InternedObligationCauseCode { - code: if let ObligationCauseCode::Misc = self { None } else { Some(Lrc::new(self)) }, + code: if let ObligationCauseCode::Misc = self { None } else { Some(Arc::new(self)) }, } } } |
