simplify generational box by compressing debug info

This commit is contained in:
Jonathan Kelley committed 2024-01-22 21:17:02 -08:00
1 parent 27f8377ea5
commit 079fec3be6
7 files changed
+162 -163

No files matched your search

+4 -6
View File
@@ -56,8 +56,6 @@ impl<T: Sync + Send + 'static> Storage<T> for SyncStorage {
fn try_read(
&'static self,
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
created_at: &'static std::panic::Location<'static>,
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
at: crate::GenerationalRefBorrowInfo,
) -> Result<Self::Ref<T>, error::BorrowError> {
let read = self.0.try_read();
@@ -74,7 +72,7 @@ impl<T: Sync + Send + 'static> Storage<T> for SyncStorage {
.map_err(|_| {
error::BorrowError::Dropped(ValueDroppedError {
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
created_at,
created_at: at.created_at,
})
})
.map(|guard| {
@@ -89,8 +87,6 @@ impl<T: Sync + Send + 'static> Storage<T> for SyncStorage {
fn try_write(
&'static self,
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
created_at: &'static std::panic::Location<'static>,
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
at: crate::GenerationalRefMutBorrowInfo,
) -> Result<Self::Mut<T>, error::BorrowMutError> {
let write = self.0.try_write();
@@ -107,7 +103,7 @@ impl<T: Sync + Send + 'static> Storage<T> for SyncStorage {
.map_err(|_| {
error::BorrowMutError::Dropped(ValueDroppedError {
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
created_at,
created_at: at.created_at,
})
})
.map(|guard| {
@@ -141,6 +137,7 @@ impl<T: Sync + Send + 'static> Storage<T> for SyncStorage {
borrow: GenerationalRefBorrowInfo {
borrowed_at: borrow.borrowed_at,
borrowed_from: borrow.borrowed_from,
created_at: borrow.created_at,
},
})
}
@@ -162,6 +159,7 @@ impl<T: Sync + Send + 'static> Storage<T> for SyncStorage {
#[cfg(any(debug_assertions, feature = "debug_borrows"))]
borrow: GenerationalRefMutBorrowInfo {
borrowed_from: borrow.borrowed_from,
created_at: borrow.created_at,
},
})
}