Skip to content

Commit 4ea610e

Browse files
Remove jobserver Client from Session
We want to restrict access to the raw Client and this is the first step to doing so; the client is still initialized from the environment at the same time.
1 parent aa61304 commit 4ea610e

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/librustc_codegen_ssa/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(
453453
codegen_worker_send,
454454
coordinator_receive,
455455
total_cgus,
456-
sess.jobserver.clone(),
456+
rustc_jobserver::client(),
457457
Arc::new(modules_config),
458458
Arc::new(metadata_config),
459459
Arc::new(allocator_config),

src/librustc_jobserver/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ lazy_static! {
2929
};
3030
}
3131

32+
pub fn initialize() {
33+
lazy_static::initialize(&GLOBAL_CLIENT)
34+
}
35+
3236
pub fn client() -> Client {
3337
GLOBAL_CLIENT.clone()
3438
}

src/librustc_session/session.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,6 @@ pub struct Session {
119119
/// Always set to zero and incremented so that we can print fuel expended by a crate.
120120
pub print_fuel: AtomicU64,
121121

122-
/// Loaded up early on in the initialization of this `Session` to avoid
123-
/// false positives about a job server in our environment.
124-
pub jobserver: Client,
125-
126122
/// Cap lint level specified by a driver specifically.
127123
pub driver_lint_caps: FxHashMap<lint::LintId, lint::Level>,
128124

@@ -1036,6 +1032,8 @@ fn build_session_(
10361032
sopts.debugging_opts.time_passes,
10371033
);
10381034

1035+
rustc_jobserver::initialize();
1036+
10391037
let sess = Session {
10401038
target: target_cfg,
10411039
host,
@@ -1068,7 +1066,6 @@ fn build_session_(
10681066
optimization_fuel,
10691067
print_fuel_crate,
10701068
print_fuel,
1071-
jobserver: jobserver::client(),
10721069
driver_lint_caps,
10731070
trait_methods_not_found: Lock::new(Default::default()),
10741071
confused_type_with_std_module: Lock::new(Default::default()),

0 commit comments

Comments
 (0)