mirror of
https://github.com/rtic-rs/rtic.git
synced 2025-12-16 21:05:35 +01:00
chore: compile fail tests to assert that the future returned by wait_until is *not* Unpin
This commit is contained in:
parent
11f1bc60fa
commit
14803e6639
1 changed files with 18 additions and 0 deletions
|
|
@ -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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue