fix signal error message and add tests (#2118)
This commit is contained in:
1 parent
58f7efafea
commit
9f283f571f
10 files changed
+187
-121
No files matched your search
@@ -73,10 +73,7 @@ impl AnyStorage for SyncStorage {
|
||||
.map(|inner| GenerationalRefMut {
|
||||
inner,
|
||||
#[cfg(any(debug_assertions, feature = "debug_borrows"))]
|
||||
borrow: crate::GenerationalRefMutBorrowInfo {
|
||||
borrowed_from: borrow.borrowed_from,
|
||||
created_at: borrow.created_at,
|
||||
},
|
||||
borrow,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -147,20 +144,17 @@ impl<T: Sync + Send + 'static> Storage<T> for SyncStorage {
|
||||
) -> Result<Self::Mut<'static, T>, error::BorrowMutError> {
|
||||
let write = self.0.write();
|
||||
|
||||
RwLockWriteGuard::try_map(write, |any| any.as_mut()?.downcast_mut())
|
||||
.map_err(|_| {
|
||||
error::BorrowMutError::Dropped(ValueDroppedError {
|
||||
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
|
||||
created_at: at.created_at,
|
||||
})
|
||||
})
|
||||
.map(|guard| {
|
||||
GenerationalRefMut::new(
|
||||
guard,
|
||||
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
|
||||
at,
|
||||
)
|
||||
})
|
||||
match RwLockWriteGuard::try_map(write, |any| any.as_mut()?.downcast_mut()) {
|
||||
Ok(guard) => Ok(GenerationalRefMut::new(
|
||||
guard,
|
||||
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
|
||||
at,
|
||||
)),
|
||||
Err(_) => Err(error::BorrowMutError::Dropped(ValueDroppedError {
|
||||
#[cfg(any(debug_assertions, feature = "debug_ownership"))]
|
||||
created_at: at.created_at,
|
||||
})),
|
||||
}
|
||||
}
|
||||
|
||||
fn set(&self, value: T) {
|
||||
|
||||
Reference in new issue
Block a user