use firefly::{mpmc, mpsc, spmc, spsc}; use static_assertions::{assert_impl_all, assert_not_impl_any}; struct SendNotSync(*mut ()); unsafe impl Sync for SendNotSync {} #[test] fn auto_traits() { // spsc assert_impl_all!(spsc::Sender<()>: Send, Sync); assert_not_impl_any!(spsc::Sender<()>: Clone); assert_not_impl_any!(spsc::Sender: Send); assert_impl_all!(spsc::Receiver<()>: Send, Sync); assert_not_impl_any!(spsc::Receiver<()>: Clone); assert_not_impl_any!(spsc::Receiver: Send); assert_impl_all!(spsc::UnboundedSender<()>: Send, Sync); assert_not_impl_any!(spsc::UnboundedSender<()>: Clone); assert_not_impl_any!(spsc::UnboundedSender: Send); assert_impl_all!(spsc::UnboundedReceiver<()>: Send, Sync); assert_not_impl_any!(spsc::UnboundedReceiver<()>: Clone); assert_not_impl_any!(spsc::UnboundedReceiver: Send); // mpsc assert_impl_all!(mpsc::Sender<()>: Send, Sync, Clone); assert_not_impl_any!(mpsc::Sender: Send, Sync); assert_impl_all!(mpsc::UnboundedSender<()>: Send, Sync, Clone); assert_not_impl_any!(mpsc::UnboundedSender: Send, Sync); assert_impl_all!(mpsc::Receiver<()>: Send, Sync); assert_not_impl_any!(mpsc::Receiver<()>: Clone); assert_not_impl_any!(mpsc::Receiver: Send, Sync, Clone); assert_impl_all!(mpsc::UnboundedReceiver<()>: Send, Sync); assert_not_impl_any!(mpsc::UnboundedReceiver<()>: Clone); assert_not_impl_any!(mpsc::UnboundedReceiver: Send, Sync, Clone); // spmc assert_impl_all!(spmc::Sender<()>: Send, Sync); assert_not_impl_any!(spmc::Sender<()>: Clone); assert_not_impl_any!(spmc::Sender: Send, Sync); assert_impl_all!(spmc::UnboundedSender<()>: Send, Sync); assert_not_impl_any!(spmc::UnboundedSender<()>: Clone); assert_not_impl_any!(spmc::UnboundedSender: Send, Sync); assert_impl_all!(spmc::Receiver<()>: Send, Sync, Clone); assert_not_impl_any!(spmc::Receiver: Send, Sync); assert_impl_all!(spmc::UnboundedReceiver<()>: Send, Sync, Clone); assert_not_impl_any!(spmc::UnboundedReceiver: Send, Sync); // mpmc assert_impl_all!(mpmc::Sender<()>: Send, Sync, Clone); assert_not_impl_any!(mpmc::Sender: Send, Sync); assert_impl_all!(mpmc::UnboundedSender<()>: Send, Sync, Clone); assert_not_impl_any!(mpmc::UnboundedSender: Send, Sync); assert_impl_all!(mpmc::Receiver<()>: Send, Sync, Clone); assert_not_impl_any!(mpmc::Receiver: Send, Sync); assert_impl_all!(mpmc::UnboundedReceiver<()>: Send, Sync, Clone); assert_not_impl_any!(mpmc::UnboundedReceiver: Send, Sync); }