Split stack_popn asserts for improved error messages
@@ -491,7 +491,13 @@ impl StackPrimitives for YoungHeap {
#[inline]
fn stack_popn(&mut self, n: usize) {
- assert!(n > 0 && n <= self.stack_size);
+ assert!(n > 0);
+ assert!(
+ n <= self.stack_size,
+ "Trying to pop {} terms from stack that only has {} terms",
+ n,
+ self.stack_size
+ );
if self.stack_size - n == 0 {
// Freeing the whole stack
self.stack_start = self.stack_end;
