From 100b429ec0c7322690e8927a18fe42dc5736bb05 Mon Sep 17 00:00:00 2001 From: Kerollmops Date: Thu, 6 Mar 2025 10:30:17 +0100 Subject: [PATCH] Add a test to check that iterators are not Send --- heed/src/iterator/mod.rs | 93 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 93 insertions(+) diff --git a/heed/src/iterator/mod.rs b/heed/src/iterator/mod.rs index 12341dd8..9622fbe4 100644 --- a/heed/src/iterator/mod.rs +++ b/heed/src/iterator/mod.rs @@ -6,6 +6,99 @@ pub use self::iter::{RoIter, RoRevIter, RwIter, RwRevIter}; pub use self::prefix::{RoPrefix, RoRevPrefix, RwPrefix, RwRevPrefix}; pub use self::range::{RoRange, RoRevRange, RwRange, RwRevRange}; +/// This is just set of tests to check that the Cursors +/// are not Send. We need to use doc test as it is the +/// only way to check for expected compilation failures. +/// +/// ```rust,compile_fail +/// use heed::types::*; +/// use heed::RoIter; +/// fn is_send() {} +/// is_send::>(); +/// ``` +/// +/// ```rust,compile_fail +/// use heed::types::*; +/// use heed::RoRevIter; +/// fn is_send() {} +/// is_send::>(); +/// ``` +/// +/// ```rust,compile_fail +/// use heed::types::*; +/// use heed::RoRange; +/// fn is_send() {} +/// is_send::>(); +/// ``` +/// +/// ```rust,compile_fail +/// use heed::types::*; +/// use heed::RoRevRange; +/// fn is_send() {} +/// is_send::>(); +/// ``` +/// +/// ```rust,compile_fail +/// use heed::types::*; +/// use heed::RoPrefix; +/// fn is_send() {} +/// is_send::>(); +/// ``` +/// +/// ```rust,compile_fail +/// use heed::types::*; +/// use heed::RoRevPrefix; +/// fn is_send() {} +/// is_send::>(); +/// ``` +/// +/// Starting the next section with the Read-write Iterators. +/// +/// ```rust,compile_fail +/// use heed::types::*; +/// use heed::RwIter; +/// fn is_send() {} +/// is_send::>(); +/// ``` +/// +/// ```rust,compile_fail +/// use heed::types::*; +/// use heed::RwRevIter; +/// fn is_send() {} +/// is_send::>(); +/// ``` +/// +/// ```rust,compile_fail +/// use heed::types::*; +/// use heed::RwRange; +/// fn is_send() {} +/// is_send::>(); +/// ``` +/// +/// ```rust,compile_fail +/// use heed::types::*; +/// use heed::RwRevRange; +/// fn is_send() {} +/// is_send::>(); +/// ``` +/// +/// ```rust,compile_fail +/// use heed::types::*; +/// use heed::RwPrefix; +/// fn is_send() {} +/// is_send::>(); +/// ``` +/// +/// ```rust,compile_fail +/// use heed::types::*; +/// use heed::RwRevPrefix; +/// fn is_send() {} +/// is_send::>(); +/// ``` +#[doc(hidden)] +#[allow(unused)] +fn test_txns_are_not_send() {} + #[cfg(test)] mod tests { use std::ops;