Skip to content

Commit 25b6002

Browse files
committed
rtic-sync: add note about assert & update another to debug_assert
1 parent e9032e9 commit 25b6002

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

rtic-sync/src/channel.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ impl<T, const N: usize> Channel<T, N> {
110110

111111
// Fill free queue
112112
for idx in 0..N as u8 {
113+
// NOTE(assert): `split`-ing does not put `freeq` into a known-empty
114+
// state, so `debug_assert` is not good enough.
113115
assert!(!freeq.is_full());
114116

115117
// 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> {
118120
}
119121
}
120122

121-
assert!(freeq.is_full());
123+
debug_assert!(freeq.is_full());
122124

123125
// There is now 1 sender
124126
// SAFETY: we have exclusive access to `self`.

0 commit comments

Comments
 (0)