diff --git a/src/lib.rs b/src/lib.rs index 65ff011..7c341cb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -612,6 +612,7 @@ impl FailPoint { fn set_actions(&self, actions_str: &str, actions: Vec) { loop { + #[cfg(feature = "async")] self.async_pause_notify.notify_waiters(); // TODO: maybe busy waiting here. match self.actions.try_write() { @@ -674,7 +675,10 @@ impl FailPoint { Task::Callback(f) => { f.run(); } - Task::CallbackAsync(_) => unreachable!(), + #[cfg(feature = "async")] + Task::CallbackAsync(_) => panic!( + "to use async callback, please enable `async` feature and use `async_fail_point`" + ), } None } @@ -1229,7 +1233,8 @@ mod tests { assert_eq!(f1(), 0); } - #[cfg_attr(not(all(feature = "failpoints", feature = "async")), ignore)] + #[cfg(feature = "async")] + #[cfg_attr(not(feature = "failpoints"), ignore)] #[tokio::test] async fn test_async_failpoint() { use std::time::Duration;