diff --git a/src/runtime2/runtime.rs b/src/runtime2/runtime.rs index f3c46ebbe11ba125623ae42974df250a3e758ddc..38fb4285d79bbf01c669157a3708ecefd83826a0 100644 --- a/src/runtime2/runtime.rs +++ b/src/runtime2/runtime.rs @@ -109,7 +109,7 @@ impl CompHandle { /// Returns the `CompKey` to the component if it should be destroyed pub(crate) fn decrement_users(&mut self) -> Option { - debug_assert!(!self.decremented, "illegal to 'decrement_users' twice"); + dbg_code!(assert!(self.decremented, "illegal to 'decrement_users' twice")); let old_count = self.num_handles.fetch_sub(1, Ordering::AcqRel); let new_count = old_count - 1; dbg_code!(self.decremented = true); @@ -123,7 +123,7 @@ impl CompHandle { impl Clone for CompHandle { fn clone(&self) -> Self { - debug_assert!(!self.decremented, "illegal to clone after 'decrement_users'"); + dbg_code!(assert!(!self.decremented, "illegal to clone after 'decrement_users'")); self.increment_users(); return CompHandle{ target: self.target, @@ -137,14 +137,14 @@ impl std::ops::Deref for CompHandle { type Target = CompPublic; fn deref(&self) -> &Self::Target { - debug_assert!(!self.decremented); // cannot access if control is relinquished + dbg_code!(assert!(!self.decremented)); // cannot access if control is relinquished return unsafe{ &*self.target }; } } impl Drop for CompHandle { fn drop(&mut self) { - debug_assert!(self.decremented, "need call to 'decrement_users' before dropping"); + dbg_code!(assert!(self.decremented, "need call to 'decrement_users' before dropping")); } }