1 #![warn(rust_2018_idioms)]
2 #![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support panic recovery
3 
4 use std::panic::{RefUnwindSafe, UnwindSafe};
5 
6 #[test]
notify_is_unwind_safe()7 fn notify_is_unwind_safe() {
8     is_unwind_safe::<tokio::sync::Notify>();
9 }
10 
11 #[test]
join_handle_is_unwind_safe()12 fn join_handle_is_unwind_safe() {
13     is_unwind_safe::<tokio::task::JoinHandle<()>>();
14 }
15 
16 #[test]
net_types_are_unwind_safe()17 fn net_types_are_unwind_safe() {
18     is_unwind_safe::<tokio::net::TcpListener>();
19     is_unwind_safe::<tokio::net::TcpSocket>();
20     is_unwind_safe::<tokio::net::TcpStream>();
21     is_unwind_safe::<tokio::net::UdpSocket>();
22 }
23 
24 #[test]
25 #[cfg(unix)]
unix_net_types_are_unwind_safe()26 fn unix_net_types_are_unwind_safe() {
27     is_unwind_safe::<tokio::net::UnixDatagram>();
28     is_unwind_safe::<tokio::net::UnixListener>();
29     is_unwind_safe::<tokio::net::UnixStream>();
30 }
31 
32 #[test]
33 #[cfg(windows)]
windows_net_types_are_unwind_safe()34 fn windows_net_types_are_unwind_safe() {
35     use tokio::net::windows::named_pipe::NamedPipeClient;
36     use tokio::net::windows::named_pipe::NamedPipeServer;
37 
38     is_unwind_safe::<NamedPipeClient>();
39     is_unwind_safe::<NamedPipeServer>();
40 }
41 
is_unwind_safe<T: UnwindSafe + RefUnwindSafe>()42 fn is_unwind_safe<T: UnwindSafe + RefUnwindSafe>() {}
43