@@ -1323,13 +1323,16 @@ fn start_executing_work(sess: &Session,
1323
1323
if main_thread_worker_state == MainThreadWorkerState :: Idle {
1324
1324
if !queue_full_enough ( work_items. len ( ) , running, max_workers) {
1325
1325
// 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
+ }
1327
1329
main_thread_worker_state = MainThreadWorkerState :: Translating ;
1328
1330
} else {
1329
1331
// The queue is full enough to not let the worker
1330
1332
// threads starve. Use the implicit Token to do some
1331
1333
// LLVM work too.
1332
- let ( item, _) = work_items. pop ( ) . unwrap ( ) ;
1334
+ let ( item, _) = work_items. pop ( )
1335
+ . expect ( "queue empty - queue_full_enough() broken?" ) ;
1333
1336
let cgcx = CodegenContext {
1334
1337
worker : get_worker_id ( & mut free_worker_ids) ,
1335
1338
.. cgcx. clone ( )
@@ -1406,7 +1409,7 @@ fn start_executing_work(sess: &Session,
1406
1409
let msg = & format ! ( "failed to acquire jobserver token: {}" , e) ;
1407
1410
shared_emitter. fatal ( msg) ;
1408
1411
// Exit the coordinator thread
1409
- panic ! ( )
1412
+ panic ! ( "{}" , msg )
1410
1413
}
1411
1414
}
1412
1415
}
@@ -1475,7 +1478,7 @@ fn start_executing_work(sess: &Session,
1475
1478
Message :: Done { result : Err ( ( ) ) , worker_id : _ } => {
1476
1479
shared_emitter. fatal ( "aborting due to worker thread panic" ) ;
1477
1480
// Exit the coordinator thread
1478
- panic ! ( )
1481
+ panic ! ( "aborting due to worker thread panic" )
1479
1482
}
1480
1483
Message :: TranslateItem => {
1481
1484
bug ! ( "the coordinator should not receive translation requests" )
@@ -1493,9 +1496,12 @@ fn start_executing_work(sess: &Session,
1493
1496
total_llvm_time) ;
1494
1497
}
1495
1498
1499
+ let compiled_metadata_module = compiled_metadata_module
1500
+ . expect ( "Metadata module not compiled?" ) ;
1501
+
1496
1502
CompiledModules {
1497
1503
modules : compiled_modules,
1498
- metadata_module : compiled_metadata_module. unwrap ( ) ,
1504
+ metadata_module : compiled_metadata_module,
1499
1505
allocator_module : compiled_allocator_module,
1500
1506
}
1501
1507
} ) ;
@@ -1506,6 +1512,7 @@ fn start_executing_work(sess: &Session,
1506
1512
workers_running : usize ,
1507
1513
max_workers : usize ) -> bool {
1508
1514
// Tune me, plz.
1515
+ items_in_queue > 0 &&
1509
1516
items_in_queue >= max_workers. saturating_sub ( workers_running / 2 )
1510
1517
}
1511
1518
@@ -1805,7 +1812,12 @@ pub struct OngoingCrateTranslation {
1805
1812
impl OngoingCrateTranslation {
1806
1813
pub fn join ( self , sess : & Session ) -> CrateTranslation {
1807
1814
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
+ } ;
1809
1821
1810
1822
sess. abort_if_errors ( ) ;
1811
1823
0 commit comments