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`
This commit is contained in:
commit
dd8ec9c88d
26 changed files with 557 additions and 110 deletions
|
@ -8,7 +8,7 @@ use rustc_data_structures::fingerprint::Fingerprint;
|
|||
use rustc_data_structures::fx::{FxHashMap, FxIndexSet};
|
||||
use rustc_data_structures::memmap::{Mmap, MmapMut};
|
||||
use rustc_data_structures::stable_hasher::{Hash128, HashStable, StableHasher};
|
||||
use rustc_data_structures::sync::{join, par_iter, Lrc, ParallelIterator};
|
||||
use rustc_data_structures::sync::{join, par_for_each_in, Lrc};
|
||||
use rustc_data_structures::temp_dir::MaybeTempDir;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
|
@ -2131,7 +2131,7 @@ fn prefetch_mir(tcx: TyCtxt<'_>) {
|
|||
return;
|
||||
}
|
||||
|
||||
par_iter(tcx.mir_keys(())).for_each(|&def_id| {
|
||||
par_for_each_in(tcx.mir_keys(()), |&def_id| {
|
||||
let (encode_const, encode_opt) = should_encode_mir(tcx, def_id);
|
||||
|
||||
if encode_const {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue