From dae55bd7e40eb8bbf6ead20cc55858485a70d28c Mon Sep 17 00:00:00 2001 From: datdenkikniet Date: Sun, 23 Mar 2025 10:12:15 +0100 Subject: [PATCH] rtic-sync: add note about assert & update another to debug_assert --- rtic-sync/src/channel.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rtic-sync/src/channel.rs b/rtic-sync/src/channel.rs index d2eb7917048..b2792a28496 100644 --- a/rtic-sync/src/channel.rs +++ b/rtic-sync/src/channel.rs @@ -110,6 +110,8 @@ impl Channel { // Fill free queue for idx in 0..N as u8 { + // NOTE(assert): `split`-ing does not put `freeq` into a known-empty + // state, so `debug_assert` is not good enough. assert!(!freeq.is_full()); // SAFETY: This safe as the loop goes from 0 to the capacity of the underlying queue. @@ -118,7 +120,7 @@ impl Channel { } } - assert!(freeq.is_full()); + debug_assert!(freeq.is_full()); // There is now 1 sender // SAFETY: we have exclusive access to `self`.