Skip to content

Commit 0689914

Browse files
Move jobserver initialization before thread pool creation
1 parent 3900705 commit 0689914

File tree

4 files changed

+14
-17
lines changed

4 files changed

+14
-17
lines changed

Cargo.lock

-1
Original file line numberDiff line numberDiff line change
@@ -3868,7 +3868,6 @@ dependencies = [
38683868
"rustc_feature",
38693869
"rustc_fs_util",
38703870
"rustc_index",
3871-
"rustc_jobserver",
38723871
"rustc_target",
38733872
"serialize",
38743873
"syntax_pos",

src/librustc_interface/interface.rs

+14
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,20 @@ pub fn run_compiler_in_existing_thread_pool<R>(
181181

182182
pub fn run_compiler<R: Send>(mut config: Config, f: impl FnOnce(&Compiler) -> R + Send) -> R {
183183
let stderr = config.stderr.take();
184+
185+
if config.opts.debugging_opts.jobserver_token_requests {
186+
if let config::ErrorOutputType::Json { .. } = config.opts.error_format {
187+
if stderr.is_some() {
188+
panic!("Non-default output not supported with -Zjobserver-token-requests");
189+
}
190+
} else {
191+
panic!("-Zjobserver-token-requests can only be specified if using \
192+
JSON error output type");
193+
}
194+
}
195+
196+
rustc_jobserver::initialize(config.opts.debugging_opts.jobserver_token_requests);
197+
184198
util::spawn_thread_pool(
185199
config.opts.edition,
186200
config.opts.debugging_opts.threads,

src/librustc_session/Cargo.toml

-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ syntax_pos = { path = "../libsyntax_pos" }
1919
rustc_index = { path = "../librustc_index" }
2020
rustc_fs_util = { path = "../librustc_fs_util" }
2121
num_cpus = "1.0"
22-
rustc_jobserver = { path = "../librustc_jobserver" }

src/librustc_session/session.rs

-15
Original file line numberDiff line numberDiff line change
@@ -1126,21 +1126,6 @@ fn build_session_(
11261126
CguReuseTracker::new_disabled()
11271127
};
11281128

1129-
if sopts.debugging_opts.jobserver_token_requests {
1130-
if let config::ErrorOutputType::Json { .. } = sopts.error_format {
1131-
if is_diagnostic_output_raw {
1132-
panic!("Raw output format not supported with -Zjobserver-token-requests");
1133-
}
1134-
} else {
1135-
parse_sess.span_diagnostic
1136-
.fatal("-Zjobserver-token-requests can only be specified if \
1137-
using JSON error output type")
1138-
.raise();
1139-
}
1140-
}
1141-
1142-
rustc_jobserver::initialize(sopts.debugging_opts.jobserver_token_requests);
1143-
11441129
let sess = Session {
11451130
target: target_cfg,
11461131
host,

0 commit comments

Comments
 (0)