Skip to content

Commit

Permalink
api: test for RefUnwindSafe
Browse files Browse the repository at this point in the history
Requiring UnwindSafe is seemingly not sufficient. We also need to
require RefUnwindSafe.
  • Loading branch information
BurntSushi committed Mar 31, 2019
1 parent e5a6236 commit 5f220e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/ahocorasick.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2016,11 +2016,11 @@ mod tests {

#[test]
fn oibits() {
use std::panic::UnwindSafe;
use std::panic::{RefUnwindSafe, UnwindSafe};

fn assert_send<T: Send>() {}
fn assert_sync<T: Sync>() {}
fn assert_unwind_safe<T: UnwindSafe>() {}
fn assert_unwind_safe<T: RefUnwindSafe + UnwindSafe>() {}

assert_send::<AhoCorasick>();
assert_sync::<AhoCorasick>();
Expand Down
4 changes: 2 additions & 2 deletions src/prefilter.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::fmt;
use std::panic::UnwindSafe;
use std::panic::{RefUnwindSafe, UnwindSafe};

use memchr::{memchr, memchr2, memchr3};

/// A prefilter describes the behavior of fast literal scanners for quickly
/// skipping past bytes in the haystack that we know cannot possibly
/// participate in a match.
pub trait Prefilter: Send + Sync + UnwindSafe + fmt::Debug {
pub trait Prefilter: Send + Sync + RefUnwindSafe + UnwindSafe + fmt::Debug {
/// Returns the next possible match candidate. This may yield false
/// positives, so callers must "confirm" a match starting at the position
/// returned. This, however, must never produce false negatives. That is,
Expand Down

0 comments on commit 5f220e6

Please sign in to comment.