@@ -1192,7 +1192,7 @@ fn start_executing_work(tcx: TyCtxt,
1192
1192
modules_config : Arc < ModuleConfig > ,
1193
1193
metadata_config : Arc < ModuleConfig > ,
1194
1194
allocator_config : Arc < ModuleConfig > )
1195
- -> thread:: JoinHandle < CompiledModules > {
1195
+ -> thread:: JoinHandle < Result < CompiledModules , ( ) > > {
1196
1196
let coordinator_send = tcx. tx_to_llvm_workers . clone ( ) ;
1197
1197
let mut exported_symbols = FxHashMap ( ) ;
1198
1198
exported_symbols. insert ( LOCAL_CRATE , tcx. exported_symbols ( LOCAL_CRATE ) ) ;
@@ -1638,7 +1638,7 @@ fn start_executing_work(tcx: TyCtxt,
1638
1638
Message :: Done { result : Err ( ( ) ) , worker_id : _ } => {
1639
1639
shared_emitter. fatal ( "aborting due to worker thread failure" ) ;
1640
1640
// Exit the coordinator thread
1641
- panic ! ( "aborting due to worker thread failure" )
1641
+ return Err ( ( ) )
1642
1642
}
1643
1643
Message :: TranslateItem => {
1644
1644
bug ! ( "the coordinator should not receive translation requests" )
@@ -1664,11 +1664,11 @@ fn start_executing_work(tcx: TyCtxt,
1664
1664
let compiled_metadata_module = compiled_metadata_module
1665
1665
. expect ( "Metadata module not compiled?" ) ;
1666
1666
1667
- CompiledModules {
1667
+ Ok ( CompiledModules {
1668
1668
modules : compiled_modules,
1669
1669
metadata_module : compiled_metadata_module,
1670
1670
allocator_module : compiled_allocator_module,
1671
- }
1671
+ } )
1672
1672
} ) ;
1673
1673
1674
1674
// A heuristic that determines if we have enough LLVM WorkItems in the
@@ -1960,15 +1960,19 @@ pub struct OngoingCrateTranslation {
1960
1960
coordinator_send : Sender < Box < Any + Send > > ,
1961
1961
trans_worker_receive : Receiver < Message > ,
1962
1962
shared_emitter_main : SharedEmitterMain ,
1963
- future : thread:: JoinHandle < CompiledModules > ,
1963
+ future : thread:: JoinHandle < Result < CompiledModules , ( ) > > ,
1964
1964
output_filenames : Arc < OutputFilenames > ,
1965
1965
}
1966
1966
1967
1967
impl OngoingCrateTranslation {
1968
1968
pub fn join ( self , sess : & Session , dep_graph : & DepGraph ) -> CrateTranslation {
1969
1969
self . shared_emitter_main . check ( sess, true ) ;
1970
1970
let compiled_modules = match self . future . join ( ) {
1971
- Ok ( compiled_modules) => compiled_modules,
1971
+ Ok ( Ok ( compiled_modules) ) => compiled_modules,
1972
+ Ok ( Err ( ( ) ) ) => {
1973
+ sess. abort_if_errors ( ) ;
1974
+ panic ! ( "expected abort due to worker thread errors" )
1975
+ } ,
1972
1976
Err ( _) => {
1973
1977
sess. fatal ( "Error during translation/LLVM phase." ) ;
1974
1978
}
0 commit comments