From 14803e66399d4f5f6377c487b50cff2565aeaea5 Mon Sep 17 00:00:00 2001 From: Oleksandr Babak Date: Thu, 15 May 2025 14:04:25 +0200 Subject: [PATCH] chore: compile fail tests to assert that the future returned by `wait_until` is *not* `Unpin` --- rtic-common/src/wait_queue.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/rtic-common/src/wait_queue.rs b/rtic-common/src/wait_queue.rs index de27710aeac..cd42fe2afc1 100644 --- a/rtic-common/src/wait_queue.rs +++ b/rtic-common/src/wait_queue.rs @@ -289,6 +289,24 @@ impl Link { } } +/// Test that the future returned by `wait_until` is not `Unpin`. +/// ```compile_fail +/// fn test_unpin(list: &rtic_common::wait_queue::DoublyLinkedList, cx: &mut core::task::Context) { +/// let mut wait_until_future = list.wait_until(|| None::<()>); +/// let pinned = core::pin::Pin::new(&mut wait_until_future); +/// core::future::Future::poll(pinned, cx); +/// } +/// ``` +/// This test will ensure that previous test failed because of `pin`. +/// ``` +/// fn test_unpin(list: &rtic_common::wait_queue::DoublyLinkedList, cx: &mut core::task::Context) { +/// let mut wait_until_future = list.wait_until(|| None::<()>); +/// let pinned = core::pin::pin!(wait_until_future); +/// core::future::Future::poll(pinned, cx); +/// } +/// ``` +mod compile_fail_test {} + #[cfg(test)] mod tests { use super::*;