diff options
| author | Oleksandr Babak <alexanderbabak@proton.me> | 2025-05-15 14:04:25 +0200 |
|---|---|---|
| committer | Henrik Tjäder <henrik@tjaders.com> | 2025-06-15 09:03:30 +0000 |
| commit | 14803e66399d4f5f6377c487b50cff2565aeaea5 (patch) | |
| tree | 6988c892f5bcf4aa70ffa27aba094ed94de93f01 /rtic-common/src | |
| parent | 11f1bc60fa76a6d8bfaa86cf5f18fe91c5ff0278 (diff) | |
chore: compile fail tests to assert that the future returned by `wait_until` is *not* `Unpin`
Diffstat (limited to 'rtic-common/src')
| -rw-r--r-- | rtic-common/src/wait_queue.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/rtic-common/src/wait_queue.rs b/rtic-common/src/wait_queue.rs index de27710..cd42fe2 100644 --- a/rtic-common/src/wait_queue.rs +++ b/rtic-common/src/wait_queue.rs @@ -289,6 +289,24 @@ impl<T: core::fmt::Debug + Clone> Link<T> { } } +/// Test that the future returned by `wait_until` is not `Unpin`. +/// ```compile_fail +/// fn test_unpin(list: &rtic_common::wait_queue::DoublyLinkedList<core::task::Waker>, 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<core::task::Waker>, 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::*; |
