Fix generational box in release mode

This commit is contained in:
Jonathan Kelley committed 2024-01-21 12:46:19 -08:00
1 parent 06d9b575b7
commit 028f499bf6
10 files changed
+182 -34

No files matched your search

+6 -1
View File
@@ -244,6 +244,7 @@ impl<T: 'static, S: Storage<T>> GenerationalBox<T, S> {
);
if result.is_ok() {
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
self.raw
.0
.borrow
@@ -280,7 +281,10 @@ impl<T: 'static, S: Storage<T>> GenerationalBox<T, S> {
);
if result.is_ok() {
*self.raw.0.borrow.borrowed_mut_at.write() = Some(std::panic::Location::caller());
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
{
*self.raw.0.borrow.borrowed_mut_at.write() = Some(std::panic::Location::caller());
}
}
result
@@ -419,6 +423,7 @@ struct MemoryLocationBorrowInfo {
pub(crate) borrowed_mut_at: parking_lot::RwLock<Option<&'static std::panic::Location<'static>>>,
}
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
impl MemoryLocationBorrowInfo {
fn borrow_mut_error(&self) -> BorrowMutError {
if let Some(borrowed_mut_at) = self.borrowed_mut_at.read().as_ref() {