about summary refs log tree commit diff
path: root/compiler/rustc_session
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-05-13 13:47:53 +0000
committerbors <bors@rust-lang.org>2023-05-13 13:47:53 +0000
commitdd8ec9c88d4d87986cbf2083c398ab6c52dc3f80 (patch)
tree22ad92e8e8006bb13148563bd267e6a09b552a88 /compiler/rustc_session
parentebf2b375e16b3b1422d48892d235d83a1b451802 (diff)
parentd7e3e5bede187d113fa01c4d8b8c16a2bd4f721c (diff)
downloadrust-dd8ec9c88d4d87986cbf2083c398ab6c52dc3f80.tar.gz
rust-dd8ec9c88d4d87986cbf2083c398ab6c52dc3f80.zip
Auto merge of #107586 - SparrowLii:parallel-query, r=cjgillot
Introduce `DynSend` and `DynSync` auto trait for parallel compiler

part of parallel-rustc #101566

This PR introduces `DynSend / DynSync` trait and `FromDyn / IntoDyn` structure in rustc_data_structure::marker. `FromDyn` can dynamically check data structures for thread safety when switching to parallel environments (such as calling `par_for_each_in`). This happens only when `-Z threads > 1` so it doesn't affect single-threaded mode's compile efficiency.

r? `@cjgillot`
Diffstat (limited to 'compiler/rustc_session')
-rw-r--r--compiler/rustc_session/src/cstore.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/rustc_session/src/cstore.rs b/compiler/rustc_session/src/cstore.rs
index dd1721801f3..8089d81cc22 100644
--- a/compiler/rustc_session/src/cstore.rs
+++ b/compiler/rustc_session/src/cstore.rs
@@ -207,7 +207,7 @@ pub trait MetadataLoader: std::fmt::Debug {
     fn get_dylib_metadata(&self, target: &Target, filename: &Path) -> Result<MetadataRef, String>;
 }
 
-pub type MetadataLoaderDyn = dyn MetadataLoader + Send + Sync;
+pub type MetadataLoaderDyn = dyn MetadataLoader + Send + Sync + sync::DynSend + sync::DynSync;
 
 /// A store of Rust crates, through which their metadata can be accessed.
 ///
@@ -252,7 +252,7 @@ pub trait CrateStore: std::fmt::Debug {
     fn import_source_files(&self, sess: &Session, cnum: CrateNum);
 }
 
-pub type CrateStoreDyn = dyn CrateStore + sync::Sync + sync::Send;
+pub type CrateStoreDyn = dyn CrateStore + sync::DynSync + sync::DynSend;
 
 pub struct Untracked {
     pub cstore: RwLock<Box<CrateStoreDyn>>,