diff options
| author | datdenkikniet <jcdra1@gmail.com> | 2025-03-23 10:12:15 +0100 |
|---|---|---|
| committer | Emil Fresk <emil.fresk@gmail.com> | 2025-03-24 07:36:23 +0000 |
| commit | dae55bd7e40eb8bbf6ead20cc55858485a70d28c (patch) | |
| tree | e1d77000f18fc82e426b8860848351363cac8414 /rtic-sync | |
| parent | 39d967bf49073e4591d83ebf76cb0a006967855d (diff) | |
rtic-sync: add note about assert & update another to debug_assert
Diffstat (limited to 'rtic-sync')
| -rw-r--r-- | rtic-sync/src/channel.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/rtic-sync/src/channel.rs b/rtic-sync/src/channel.rs index d2eb791..b2792a2 100644 --- a/rtic-sync/src/channel.rs +++ b/rtic-sync/src/channel.rs @@ -110,6 +110,8 @@ impl<T, const N: usize> Channel<T, N> { // 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<T, const N: usize> Channel<T, N> { } } - assert!(freeq.is_full()); + debug_assert!(freeq.is_full()); // There is now 1 sender // SAFETY: we have exclusive access to `self`. |
