@@ -30,11 +30,10 @@ use rustc_target::spec::MergeFunctions;
3030use syntax:: attr;
3131use syntax_pos:: hygiene:: ExpnId ;
3232use syntax_pos:: symbol:: { Symbol , sym} ;
33- use jobserver :: { Client , Acquired } ;
33+ use rustc_jobserver :: Acquired ;
3434
3535use std:: any:: Any ;
3636use std:: fs;
37- use std:: io;
3837use std:: mem;
3938use std:: path:: { Path , PathBuf } ;
4039use std:: str;
@@ -433,7 +432,6 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(
433432 codegen_worker_send,
434433 coordinator_receive,
435434 total_cgus,
436- sess. jobserver . clone ( ) ,
437435 Arc :: new ( modules_config) ,
438436 Arc :: new ( metadata_config) ,
439437 Arc :: new ( allocator_config) ,
@@ -890,7 +888,7 @@ fn execute_lto_work_item<B: ExtraBackendMethods>(
890888}
891889
892890pub enum Message < B : WriteBackendMethods > {
893- Token ( io :: Result < Acquired > ) ,
891+ Token ( Acquired ) ,
894892 NeedsFatLTO {
895893 result : FatLTOInput < B > ,
896894 worker_id : usize ,
@@ -938,7 +936,6 @@ fn start_executing_work<B: ExtraBackendMethods>(
938936 codegen_worker_send : Sender < Message < B > > ,
939937 coordinator_receive : Receiver < Box < dyn Any + Send > > ,
940938 total_cgus : usize ,
941- jobserver : Client ,
942939 modules_config : Arc < ModuleConfig > ,
943940 metadata_config : Arc < ModuleConfig > ,
944941 allocator_config : Arc < ModuleConfig > ,
@@ -981,9 +978,9 @@ fn start_executing_work<B: ExtraBackendMethods>(
981978 // get tokens on `coordinator_receive` which will
982979 // get managed in the main loop below.
983980 let coordinator_send2 = coordinator_send. clone ( ) ;
984- let helper = jobserver . into_helper_thread ( move |token| {
981+ let helper = rustc_jobserver :: helper_thread ( move |token| {
985982 drop ( coordinator_send2. send ( Box :: new ( Message :: Token :: < B > ( token) ) ) ) ;
986- } ) . expect ( "failed to spawn helper thread" ) ;
983+ } ) ;
987984
988985 let mut each_linked_rlib_for_lto = Vec :: new ( ) ;
989986 drop ( link:: each_linked_rlib ( crate_info, & mut |cnum, path| {
@@ -1374,25 +1371,15 @@ fn start_executing_work<B: ExtraBackendMethods>(
13741371 // this to spawn a new unit of work, or it may get dropped
13751372 // immediately if we have no more work to spawn.
13761373 Message :: Token ( token) => {
1377- match token {
1378- Ok ( token) => {
1379- tokens. push ( token) ;
1380-
1381- if main_thread_worker_state == MainThreadWorkerState :: LLVMing {
1382- // If the main thread token is used for LLVM work
1383- // at the moment, we turn that thread into a regular
1384- // LLVM worker thread, so the main thread is free
1385- // to react to codegen demand.
1386- main_thread_worker_state = MainThreadWorkerState :: Idle ;
1387- running += 1 ;
1388- }
1389- }
1390- Err ( e) => {
1391- let msg = & format ! ( "failed to acquire jobserver token: {}" , e) ;
1392- shared_emitter. fatal ( msg) ;
1393- // Exit the coordinator thread
1394- panic ! ( "{}" , msg)
1395- }
1374+ tokens. push ( token) ;
1375+
1376+ if main_thread_worker_state == MainThreadWorkerState :: LLVMing {
1377+ // If the main thread token is used for LLVM work
1378+ // at the moment, we turn that thread into a regular
1379+ // LLVM worker thread, so the main thread is free
1380+ // to react to codegen demand.
1381+ main_thread_worker_state = MainThreadWorkerState :: Idle ;
1382+ running += 1 ;
13961383 }
13971384 }
13981385
0 commit comments