1 // Test which object types are considered sendable. This test
2 // is broken into two parts because some errors occur in distinct
3 // phases in the compiler. See kindck-send-object2.rs as well!
5 fn assert_send<T:Send+'static>() { }
8 // careful with object types, who knows what they close over...
10 assert_send::<&'a dyn Dummy>();
11 //~^ ERROR `(dyn Dummy + 'a)` cannot be shared between threads safely [E0277]
14 assert_send::<&'a (dyn Dummy + Sync)>();
17 // ...unless they are properly bounded
19 assert_send::<&'static (dyn Dummy + Sync)>();
22 assert_send::<Box<dyn Dummy + Send>>();
25 // closure and object types can have lifetime bounds which make
28 assert_send::<Box<dyn Dummy + 'a>>();
29 //~^ ERROR `(dyn Dummy + 'a)` cannot be sent between threads safely