From 018658b450b13f83c7b95a15932a718b77cc15d4 Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Wed, 19 May 2021 18:32:16 +0200 Subject: [PATCH] Explain why we don't duplicate panics from other threads --- src/derived/slot.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/derived/slot.rs b/src/derived/slot.rs index 7814a680..e0c608a6 100644 --- a/src/derived/slot.rs +++ b/src/derived/slot.rs @@ -354,7 +354,12 @@ where }, }); - let result = future.wait().unwrap_or_else(|| Canceled::throw()); + let result = future.wait().unwrap_or_else(|| { + // If the other thread panics, we treat this as cancelation: there is no + // need to panic ourselves, since the original panic will already invoke + // the panic hook and bubble up to the thread boundary (or be caught). + Canceled::throw() + }); ProbeState::UpToDate(if result.cycle.is_empty() { Ok(result.value) } else {