Skip to content

Commit

Permalink
add DynSend / DynSync for CopyTaggedPtr
Browse files Browse the repository at this point in the history
  • Loading branch information
SparrowLii committed May 6, 2023
1 parent bffccdd commit d7e3e5b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 0 additions & 2 deletions compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
#![feature(get_mut_unchecked)]
#![feature(lint_reasons)]
#![feature(unwrap_infallible)]
#![feature(const_mut_refs)]
#![feature(const_trait_impl)]
#![feature(strict_provenance)]
#![feature(ptr_alignment_type)]
#![feature(macro_metavar_expr)]
Expand Down
11 changes: 8 additions & 3 deletions compiler/rustc_data_structures/src/marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ cfg_if!(
[Box<T, A> where T: ?Sized + DynSend, A: std::alloc::Allocator + DynSend]
[crate::sync::Lock<T> where T: DynSend]
[crate::sync::RwLock<T> where T: DynSend]
[crate::tagged_ptr::CopyTaggedPtr<P, T, CP> where P: Send + crate::tagged_ptr::Pointer, T: Send + crate::tagged_ptr::Tag, const CP: bool]
[rustc_arena::TypedArena<T> where T: DynSend]
[indexmap::IndexSet<V, S> where V: DynSend, S: DynSend]
[indexmap::IndexMap<K, V, S> where K: DynSend, V: DynSend, S: DynSend]
Expand Down Expand Up @@ -175,6 +176,7 @@ cfg_if!(
[crate::sync::OneThread<T> where T]
[crate::sync::WorkerLocal<T> where T: DynSend]
[crate::intern::Interned<'a, T> where 'a, T: DynSync]
[crate::tagged_ptr::CopyTaggedPtr<P, T, CP> where P: Sync + crate::tagged_ptr::Pointer, T: Sync + crate::tagged_ptr::Tag, const CP: bool]
[parking_lot::lock_api::Mutex<R, T> where R: DynSync, T: ?Sized + DynSend]
[parking_lot::lock_api::RwLock<R, T> where R: DynSync, T: ?Sized + DynSend + DynSync]
[indexmap::IndexSet<V, S> where V: DynSync, S: DynSync]
Expand Down Expand Up @@ -218,9 +220,10 @@ unsafe impl<T: DynSend> Send for FromDyn<T> {}
#[cfg(parallel_compiler)]
unsafe impl<T: DynSync> Sync for FromDyn<T> {}

impl<T> const std::ops::Deref for FromDyn<T> {
impl<T> std::ops::Deref for FromDyn<T> {
type Target = T;

#[inline(always)]
fn deref(&self) -> &Self::Target {
&self.0
}
Expand All @@ -237,15 +240,17 @@ unsafe impl<T: ?Sized + Send> DynSend for IntoDynSyncSend<T> {}
#[cfg(parallel_compiler)]
unsafe impl<T: ?Sized + Sync> DynSync for IntoDynSyncSend<T> {}

impl<T> const std::ops::Deref for IntoDynSyncSend<T> {
impl<T> std::ops::Deref for IntoDynSyncSend<T> {
type Target = T;

#[inline(always)]
fn deref(&self) -> &T {
&self.0
}
}

impl<T> const std::ops::DerefMut for IntoDynSyncSend<T> {
impl<T> std::ops::DerefMut for IntoDynSyncSend<T> {
#[inline(always)]
fn deref_mut(&mut self) -> &mut T {
&mut self.0
}
Expand Down
5 changes: 3 additions & 2 deletions compiler/rustc_middle/src/ty/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::{FxHashMap, FxIndexMap, FxIndexSet};
use rustc_data_structures::steal::Steal;
use rustc_data_structures::svh::Svh;
use rustc_data_structures::sync::AtomicU64;use rustc_data_structures::sync::WorkerLocal;
use rustc_data_structures::sync::{self, Lrc};
use rustc_data_structures::sync::AtomicU64;
use rustc_data_structures::sync::Lrc;
use rustc_data_structures::sync::WorkerLocal;
use rustc_data_structures::unord::UnordSet;
use rustc_errors::ErrorGuaranteed;
use rustc_hir as hir;
Expand Down

0 comments on commit d7e3e5b

Please sign in to comment.