summaryrefslogtreecommitdiffstats
path: root/compiler/rustc_interface/src/interface.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:59:35 +0000
commitd1b2d29528b7794b41e66fc2136e395a02f8529b (patch)
treea4a17504b260206dec3cf55b2dca82929a348ac2 /compiler/rustc_interface/src/interface.rs
parentReleasing progress-linux version 1.72.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.tar.xz
rustc-d1b2d29528b7794b41e66fc2136e395a02f8529b.zip
Merging upstream version 1.73.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'compiler/rustc_interface/src/interface.rs')
-rw-r--r--compiler/rustc_interface/src/interface.rs23
1 files changed, 15 insertions, 8 deletions
diff --git a/compiler/rustc_interface/src/interface.rs b/compiler/rustc_interface/src/interface.rs
index 953c2e4b8..5b417e008 100644
--- a/compiler/rustc_interface/src/interface.rs
+++ b/compiler/rustc_interface/src/interface.rs
@@ -59,11 +59,6 @@ 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(
handler: &EarlyErrorHandler,
@@ -190,7 +185,8 @@ pub fn parse_check_cfg(handler: &EarlyErrorHandler, specs: Vec<String>) -> Check
ExpectedValues::Some(FxHashSet::default())
});
- let ExpectedValues::Some(expected_values) = expected_values else {
+ let ExpectedValues::Some(expected_values) = expected_values
+ else {
bug!("`expected_values` should be a list a values")
};
@@ -255,6 +251,7 @@ pub struct Config {
pub input: Input,
pub output_dir: Option<PathBuf>,
pub output_file: Option<OutFileName>,
+ pub ice_file: Option<PathBuf>,
pub file_loader: Option<Box<dyn FileLoader + Send + Sync>>,
pub locale_resources: &'static [&'static str],
@@ -288,6 +285,10 @@ pub struct Config {
#[allow(rustc::bad_opt_access)]
pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Send) -> R {
trace!("run_compiler");
+
+ // Set parallel mode before thread pool creation, which will create `Lock`s.
+ rustc_data_structures::sync::set_dyn_thread_safe_mode(config.opts.unstable_opts.threads > 1);
+
util::run_in_thread_pool_with_globals(
config.opts.edition,
config.opts.unstable_opts.threads,
@@ -315,6 +316,7 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
config.lint_caps,
config.make_codegen_backend,
registry.clone(),
+ config.ice_file,
);
if let Some(parse_sess_created) = config.parse_sess_created {
@@ -346,7 +348,11 @@ pub fn run_compiler<R: Send>(config: Config, f: impl FnOnce(&Compiler) -> R + Se
)
}
-pub fn try_print_query_stack(handler: &Handler, num_frames: Option<usize>) {
+pub fn try_print_query_stack(
+ handler: &Handler,
+ num_frames: Option<usize>,
+ file: Option<std::fs::File>,
+) {
eprintln!("query stack during panic:");
// Be careful relying on global state here: this code is called from
@@ -358,7 +364,8 @@ pub fn try_print_query_stack(handler: &Handler, num_frames: Option<usize>) {
QueryCtxt::new(icx.tcx),
icx.query,
handler,
- num_frames
+ num_frames,
+ file,
))
} else {
0