From 45c9d297c26c6650c90a8c3d4d1ed4d1ae4c05b4 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Mon, 23 May 2022 15:11:30 -0700 Subject: [PATCH] drop: downgrade two assertions to error messages These assertions were there to catch bugs, but when the bugs happen, the assertions can obsure the underlying error (as @tp-woven found out on #258). Let's just print errors instead. --- lib/src/transaction.rs | 7 ++----- lib/src/working_copy.rs | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/src/transaction.rs b/lib/src/transaction.rs index 14f98b1d1..5b334b6cf 100644 --- a/lib/src/transaction.rs +++ b/lib/src/transaction.rs @@ -175,11 +175,8 @@ impl UnpublishedOperation { impl Drop for UnpublishedOperation { fn drop(&mut self) { - if !std::thread::panicking() { - assert!( - self.closed, - "UnpublishedOperation was dropped without being closed." - ); + if !self.closed && !std::thread::panicking() { + eprintln!("BUG: UnpublishedOperation was dropped without being closed."); } } } diff --git a/lib/src/working_copy.rs b/lib/src/working_copy.rs index 4230520e9..c902ad4ec 100644 --- a/lib/src/working_copy.rs +++ b/lib/src/working_copy.rs @@ -1063,11 +1063,8 @@ impl LockedWorkingCopy<'_> { impl Drop for LockedWorkingCopy<'_> { fn drop(&mut self) { - if !std::thread::panicking() { - assert!( - self.closed, - "Working copy lock was dropped without being closed." - ); + if !self.closed && !std::thread::panicking() { + eprintln!("BUG: Working copy lock was dropped without being closed."); } } }