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)>();
15 //~^ ERROR does not fulfill the required lifetime
18 // ...unless they are properly bounded
20 assert_send::<&'static (dyn Dummy + Sync)>();
23 assert_send::<Box<dyn Dummy + Send>>();
26 // closure and object types can have lifetime bounds which make
29 assert_send::<Box<dyn Dummy + 'a>>();
30 //~^ ERROR `(dyn Dummy + 'a)` cannot be sent between threads safely