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
|
@ -60,6 +60,11 @@ impl Compiler {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(rustc::bad_opt_access)]
|
||||
pub fn set_thread_safe_mode(sopts: &config::UnstableOptions) {
|
||||
rustc_data_structures::sync::set_dyn_thread_safe_mode(sopts.threads > 1);
|
||||
}
|
||||
|
||||
/// Converts strings provided as `--cfg [cfgspec]` into a `crate_cfg`.
|
||||
pub fn parse_cfgspecs(cfgspecs: Vec<String>) -> FxHashSet<(String, Option<String>)> {
|
||||
rustc_span::create_default_session_if_not_set_then(move |_| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue