cancel_safe_futures/support.rs
1use core::future::Future;
2
3// Helper function to ensure that the futures we're returning all have the right implementations.
4pub(crate) fn assert_future<T, F>(future: F) -> F
5where
6 F: Future<Output = T>,
7{
8 future
9}
10
11// From https://twitter.com/8051Enthusiast/status/1571909110009921538
12unsafe extern "C" {
13 fn __cancel_safe_external_symbol_that_doesnt_exist();
14}
15
16#[inline]
17#[allow(dead_code)]
18pub(crate) fn statically_unreachable() -> ! {
19 unsafe {
20 __cancel_safe_external_symbol_that_doesnt_exist();
21 }
22 unreachable!("linker symbol above cannot be resolved")
23}