Skip to content

Commit

Permalink
listen: Add AssertUnwindSafe as a workaround.
Browse files Browse the repository at this point in the history
This fixes the tests under no-default-features (where the
`maybe_sync::Mutex` is really a `RefCell`).
  • Loading branch information
kpreid committed Dec 5, 2024
1 parent 9b8d343 commit f4d3f5a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions all-is-cubes/src/listen/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,12 @@ mod tests {
let listener = sl.listener();

// Poison the mutex by panicking inside it
let _ = std::panic::catch_unwind(|| {
// TODO: Get rid of this `AssertUnwindSafe` by making `StoreLock` *always* (rather than
// conditionally) `RefUnwindSafe`
let _ = std::panic::catch_unwind(core::panic::AssertUnwindSafe(|| {
let _guard = sl.lock();
panic!("poison");
});
}));

// Listener does not panic, and returns false.
assert_eq!(listener.receive(&["foo"]), false);
Expand Down

0 comments on commit f4d3f5a

Please sign in to comment.