Give better error message when decrementing refcount too far

This commit is contained in:
Richard Feldman 2022-05-29 19:57:03 -04:00
parent bacc645799
commit 6a416b16a0
No known key found for this signature in database
GPG Key ID: 7E4127D1E4241798

View File

@ -41,7 +41,8 @@ impl Storage {
if rc_as_isize == REFCOUNT_1 {
true
} else {
*rc = NonZeroIsize::new(rc_as_isize - 1).unwrap();
*rc = NonZeroIsize::new(rc_as_isize - 1).expect("A reference count was decremented all the way to zero, which should never happen.");
false
}
}