diff options
| author | Steven Fackler <sfackler@gmail.com> | 2014-04-26 18:25:20 -0700 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2014-05-01 19:07:40 -0700 |
| commit | b0b7c252d79f57e47af5f677b9e551f42657c509 (patch) | |
| tree | 20505e9beef7594687052800b33210ddc11342ce /src/libstd/cell.rs | |
| parent | 9f836d5a53e20fde65aa3469fa1826228e7c273a (diff) | |
| download | rust-b0b7c252d79f57e47af5f677b9e551f42657c509.tar.gz rust-b0b7c252d79f57e47af5f677b9e551f42657c509.zip | |
Add debug_assert and debug_assert_eq macros
I also switched some `assert!` calls over to `debug_assert!`. Closes #12049. RFC: 0015-assert
Diffstat (limited to 'src/libstd/cell.rs')
| -rw-r--r-- | src/libstd/cell.rs | 6 |
1 files changed, 3 insertions, 3 deletions
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<T> RefCell<T> { /// 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); } } |
