1 // Test which of the builtin types are considered sendable. The tests
2 // in this file all test the "kind" violates detected during kindck.
3 // See all `regions-bounded-by-send.rs`
5 fn assert_send<T:Send>() { }
7 trait Message : Send { }
9 // careful with object types, who knows what they close over...
11 fn object_ref_with_static_bound_not_ok() {
12 assert_send::<&'static (dyn Dummy + 'static)>();
13 //~^ ERROR `(dyn Dummy + 'static)` cannot be shared between threads safely [E0277]
16 fn box_object_with_no_bound_not_ok<'a>() {
17 assert_send::<Box<dyn Dummy>>();
18 //~^ ERROR `dyn Dummy` cannot be sent between threads safely
21 fn object_with_send_bound_ok() {
22 assert_send::<&'static (dyn Dummy + Sync)>();
23 assert_send::<Box<dyn Dummy + Send>>();