Skip to content

Commit 884dcee

Browse files
authored
Rollup merge of rust-lang#134251 - bjorn3:various_cleanups2, r=oli-obk
A bunch of cleanups (part 2) Just like rust-lang#133567 these were all found while looking at the respective code, but are not blocking any other changes I want to make in the short term.
2 parents 8d3a263 + c99d4f0 commit 884dcee

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

src/concurrency_limiter.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use std::sync::{Arc, Condvar, Mutex};
22

3-
use jobserver::HelperThread;
3+
use rustc_data_structures::jobserver::{self, HelperThread};
44
use rustc_errors::DiagCtxtHandle;
5-
use rustc_session::Session;
65

76
// FIXME don't panic when a worker thread panics
87

@@ -14,14 +13,13 @@ pub(super) struct ConcurrencyLimiter {
1413
}
1514

1615
impl ConcurrencyLimiter {
17-
pub(super) fn new(sess: &Session, pending_jobs: usize) -> Self {
16+
pub(super) fn new(pending_jobs: usize) -> Self {
1817
let state = Arc::new(Mutex::new(state::ConcurrencyLimiterState::new(pending_jobs)));
1918
let available_token_condvar = Arc::new(Condvar::new());
2019

2120
let state_helper = state.clone();
2221
let available_token_condvar_helper = available_token_condvar.clone();
23-
let helper_thread = sess
24-
.jobserver
22+
let helper_thread = jobserver::client()
2523
.clone()
2624
.into_helper_thread(move |token| {
2725
let mut state = state_helper.lock().unwrap();
@@ -113,7 +111,7 @@ impl Drop for ConcurrencyLimiterToken {
113111
}
114112

115113
mod state {
116-
use jobserver::Acquired;
114+
use rustc_data_structures::jobserver::Acquired;
117115

118116
#[derive(Debug)]
119117
pub(super) struct ConcurrencyLimiterState {

src/driver/aot.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ pub(crate) fn run_aot(
679679
metadata_module: None,
680680
metadata,
681681
crate_info: CrateInfo::new(tcx, target_cpu),
682-
concurrency_limiter: ConcurrencyLimiter::new(tcx.sess, 0),
682+
concurrency_limiter: ConcurrencyLimiter::new(0),
683683
});
684684
};
685685

@@ -711,7 +711,7 @@ pub(crate) fn run_aot(
711711
CguReuse::PreLto | CguReuse::PostLto => false,
712712
});
713713

714-
let concurrency_limiter = IntoDynSyncSend(ConcurrencyLimiter::new(tcx.sess, todo_cgus.len()));
714+
let concurrency_limiter = IntoDynSyncSend(ConcurrencyLimiter::new(todo_cgus.len()));
715715

716716
let modules = tcx.sess.time("codegen mono items", || {
717717
let mut modules: Vec<_> = par_map(todo_cgus, |(_, cgu)| {

src/driver/jit.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -287,12 +287,7 @@ fn dep_symbol_lookup_fn(
287287

288288
let mut dylib_paths = Vec::new();
289289

290-
let data = &crate_info
291-
.dependency_formats
292-
.iter()
293-
.find(|(crate_type, _data)| *crate_type == rustc_session::config::CrateType::Executable)
294-
.unwrap()
295-
.1;
290+
let data = &crate_info.dependency_formats[&rustc_session::config::CrateType::Executable].1;
296291
// `used_crates` is in reverse postorder in terms of dependencies. Reverse the order here to
297292
// get a postorder which ensures that all dependencies of a dylib are loaded before the dylib
298293
// itself. This helps the dynamic linker to find dylibs not in the regular dynamic library

src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
#![warn(unused_lifetimes)]
1313
// tidy-alphabetical-end
1414

15-
extern crate jobserver;
1615
#[macro_use]
1716
extern crate rustc_middle;
1817
extern crate rustc_abi;

0 commit comments

Comments
 (0)