Skip to content

Commit aa37823

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 59afaf0 commit aa37823

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/librustc_codegen_ssa/back/write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(
433433
codegen_worker_send,
434434
coordinator_receive,
435435
total_cgus,
436-
sess.jobserver.clone(),
436+
rustc_jobserver::client(),
437437
Arc::new(modules_config),
438438
Arc::new(metadata_config),
439439
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 & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ use syntax_pos::{MultiSpan, Span};
3131

3232
use rustc_target::spec::{PanicStrategy, RelroLevel, Target, TargetTriple};
3333
use rustc_data_structures::flock;
34-
use rustc_jobserver::{self as jobserver, Client};
3534
use rustc_data_structures::profiling::{SelfProfiler, SelfProfilerRef};
3635

3736
use std;
@@ -121,10 +120,6 @@ pub struct Session {
121120
/// Always set to zero and incremented so that we can print fuel expended by a crate.
122121
pub print_fuel: AtomicUsize,
123122

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

@@ -1131,6 +1126,8 @@ fn build_session_(
11311126
CguReuseTracker::new_disabled()
11321127
};
11331128

1129+
rustc_jobserver::initialize();
1130+
11341131
let sess = Session {
11351132
target: target_cfg,
11361133
host,
@@ -1163,7 +1160,6 @@ fn build_session_(
11631160
optimization_fuel,
11641161
print_fuel_crate,
11651162
print_fuel,
1166-
jobserver: jobserver::client(),
11671163
driver_lint_caps,
11681164
trait_methods_not_found: Lock::new(Default::default()),
11691165
confused_type_with_std_module: Lock::new(Default::default()),

0 commit comments

Comments
 (0)