Skip to content

Commit abef7e1

Browse files
committed
Auto merge of #45019 - aidanhs:aphs-no-trans-worker-panic, r=alexcrichton
Don't unwrap work item results as the panic trace is useless Fixes #43402 now there's no multithreaded panic printouts Also update a comment -------- Likely regressed in #43506, where the code was changed to panic in worker threads on error. Unwrapping gives zero extra information since the stack trace is so short, so we may as well just surface that there was an error and exit the thread properly. Because there are then no multithreaded printouts, I think it should mean the output of the test for #26199 is deterministic and not interleaved (thanks to @philipc #43402 (comment) for a hint). Sadly the output is now: ``` thread '<unnamed>' panicked at 'aborting due to worker thread panic', src/librustc_trans/back/write.rs:1643:20 note: Run with `RUST_BACKTRACE=1` for a backtrace. error: could not write output to : No such file or directory error: aborting due to previous error ``` but it's an improvement over the multi-panic situation before. r? @alexcrichton
2 parents a0db04b + 4a6ede7 commit abef7e1

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

src/librustc_trans/back/write.rs

+6-13
Original file line numberDiff line numberDiff line change
@@ -1636,9 +1636,9 @@ fn start_executing_work(tcx: TyCtxt,
16361636
needs_lto.push(result);
16371637
}
16381638
Message::Done { result: Err(()), worker_id: _ } => {
1639-
shared_emitter.fatal("aborting due to worker thread panic");
1639+
shared_emitter.fatal("aborting due to worker thread failure");
16401640
// Exit the coordinator thread
1641-
panic!("aborting due to worker thread panic")
1641+
panic!("aborting due to worker thread failure")
16421642
}
16431643
Message::TranslateItem => {
16441644
bug!("the coordinator should not receive translation requests")
@@ -1739,23 +1739,16 @@ fn spawn_work(cgcx: CodegenContext, work: WorkItem) {
17391739
// Execute the work itself, and if it finishes successfully then flag
17401740
// ourselves as a success as well.
17411741
//
1742-
// Note that we ignore the result coming out of `execute_work_item`
1743-
// which will tell us if the worker failed with a `FatalError`. If that
1744-
// has happened, however, then a diagnostic was sent off to the main
1745-
// thread, along with an `AbortIfErrors` message. In that case the main
1746-
// thread is already exiting anyway most likely.
1747-
//
1748-
// In any case, there's no need for us to take further action here, so
1749-
// we just ignore the result and then send off our message saying that
1750-
// we're done, which if `execute_work_item` failed is unlikely to be
1751-
// seen by the main thread, but hey we might as well try anyway.
1742+
// Note that we ignore any `FatalError` coming out of `execute_work_item`,
1743+
// as a diagnostic was already sent off to the main thread - just
1744+
// surface that there was an error in this worker.
17521745
bomb.result = {
17531746
let _timing_guard = cgcx.time_graph.as_ref().map(|tg| {
17541747
tg.start(time_graph::TimelineId(cgcx.worker),
17551748
LLVM_WORK_PACKAGE_KIND,
17561749
&work.name())
17571750
});
1758-
Some(execute_work_item(&cgcx, work).unwrap())
1751+
execute_work_item(&cgcx, work).ok()
17591752
};
17601753
});
17611754
}

0 commit comments

Comments
 (0)