@@ -1323,13 +1323,16 @@ fn start_executing_work(sess: &Session,
13231323 if main_thread_worker_state == MainThreadWorkerState :: Idle {
13241324 if !queue_full_enough ( work_items. len ( ) , running, max_workers) {
13251325 // The queue is not full enough, translate more items:
1326- trans_worker_send. send ( Message :: TranslateItem ) . unwrap ( ) ;
1326+ if let Err ( _) = trans_worker_send. send ( Message :: TranslateItem ) {
1327+ panic ! ( "Could not send Message::TranslateItem to main thread" )
1328+ }
13271329 main_thread_worker_state = MainThreadWorkerState :: Translating ;
13281330 } else {
13291331 // The queue is full enough to not let the worker
13301332 // threads starve. Use the implicit Token to do some
13311333 // LLVM work too.
1332- let ( item, _) = work_items. pop ( ) . unwrap ( ) ;
1334+ let ( item, _) = work_items. pop ( )
1335+ . expect ( "queue empty - queue_full_enough() broken?" ) ;
13331336 let cgcx = CodegenContext {
13341337 worker : get_worker_id ( & mut free_worker_ids) ,
13351338 .. cgcx. clone ( )
@@ -1406,7 +1409,7 @@ fn start_executing_work(sess: &Session,
14061409 let msg = & format ! ( "failed to acquire jobserver token: {}" , e) ;
14071410 shared_emitter. fatal ( msg) ;
14081411 // Exit the coordinator thread
1409- panic ! ( )
1412+ panic ! ( "{}" , msg )
14101413 }
14111414 }
14121415 }
@@ -1475,7 +1478,7 @@ fn start_executing_work(sess: &Session,
14751478 Message :: Done { result : Err ( ( ) ) , worker_id : _ } => {
14761479 shared_emitter. fatal ( "aborting due to worker thread panic" ) ;
14771480 // Exit the coordinator thread
1478- panic ! ( )
1481+ panic ! ( "aborting due to worker thread panic" )
14791482 }
14801483 Message :: TranslateItem => {
14811484 bug ! ( "the coordinator should not receive translation requests" )
@@ -1493,9 +1496,12 @@ fn start_executing_work(sess: &Session,
14931496 total_llvm_time) ;
14941497 }
14951498
1499+ let compiled_metadata_module = compiled_metadata_module
1500+ . expect ( "Metadata module not compiled?" ) ;
1501+
14961502 CompiledModules {
14971503 modules : compiled_modules,
1498- metadata_module : compiled_metadata_module. unwrap ( ) ,
1504+ metadata_module : compiled_metadata_module,
14991505 allocator_module : compiled_allocator_module,
15001506 }
15011507 } ) ;
@@ -1506,6 +1512,7 @@ fn start_executing_work(sess: &Session,
15061512 workers_running : usize ,
15071513 max_workers : usize ) -> bool {
15081514 // Tune me, plz.
1515+ items_in_queue > 0 &&
15091516 items_in_queue >= max_workers. saturating_sub ( workers_running / 2 )
15101517 }
15111518
@@ -1805,7 +1812,12 @@ pub struct OngoingCrateTranslation {
18051812impl OngoingCrateTranslation {
18061813 pub fn join ( self , sess : & Session ) -> CrateTranslation {
18071814 self . shared_emitter_main . check ( sess, true ) ;
1808- let compiled_modules = self . future . join ( ) . unwrap ( ) ;
1815+ let compiled_modules = match self . future . join ( ) {
1816+ Ok ( compiled_modules) => compiled_modules,
1817+ Err ( _) => {
1818+ sess. fatal ( "Error during translation/LLVM phase." ) ;
1819+ }
1820+ } ;
18091821
18101822 sess. abort_if_errors ( ) ;
18111823
0 commit comments