diff --git a/mino/src/queue.rs b/mino/src/queue.rs index 5850b88..a2d64c8 100644 --- a/mino/src/queue.rs +++ b/mino/src/queue.rs @@ -12,6 +12,10 @@ pub struct Queue<'a, T: Copy> { impl<'a, T: Copy> Queue<'a, T> { /// Constructs a new queue. pub const fn new(mut hold: Option, mut next: &'a [T]) -> Self { + if next.len() + 1 > u16::MAX as usize { + panic!("too many elements in queue"); + } + // SIGH. so `hold.is_none()` is not valid in `const fn`, for some obscure reason. #[allow(clippy::redundant_pattern_matching)] if let None = hold {