From b0b7c252d79f57e47af5f677b9e551f42657c509 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sat, 26 Apr 2014 18:25:20 -0700 Subject: Add debug_assert and debug_assert_eq macros I also switched some `assert!` calls over to `debug_assert!`. Closes #12049. RFC: 0015-assert --- src/libstd/cell.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/libstd/cell.rs') diff --git a/src/libstd/cell.rs b/src/libstd/cell.rs index ec064f4f5ec..1e4faf1a899 100644 --- a/src/libstd/cell.rs +++ b/src/libstd/cell.rs @@ -93,7 +93,7 @@ impl RefCell { /// Consumes the `RefCell`, returning the wrapped value. pub fn unwrap(self) -> T { - assert!(self.borrow.get() == UNUSED); + debug_assert!(self.borrow.get() == UNUSED); unsafe{self.value.unwrap()} } @@ -181,7 +181,7 @@ pub struct Ref<'b, T> { impl<'b, T> Drop for Ref<'b, T> { fn drop(&mut self) { let borrow = self.parent.borrow.get(); - assert!(borrow != WRITING && borrow != UNUSED); + debug_assert!(borrow != WRITING && borrow != UNUSED); self.parent.borrow.set(borrow - 1); } } @@ -202,7 +202,7 @@ pub struct RefMut<'b, T> { impl<'b, T> Drop for RefMut<'b, T> { fn drop(&mut self) { let borrow = self.parent.borrow.get(); - assert!(borrow == WRITING); + debug_assert!(borrow == WRITING); self.parent.borrow.set(UNUSED); } } -- cgit 1.4.1-3-g733a5