1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // Test which of the builtin types are considered sendable. The tests
12 // in this file all test the "kind" violates detected during kindck.
13 // See all `regions-bounded-by-send.rs`
15 fn assert_send<T:Send>() { }
17 trait Message : Send { }
19 // careful with object types, who knows what they close over...
21 fn object_ref_with_static_bound_not_ok() {
22 assert_send::<&'static (Dummy+'static)>();
23 //~^ ERROR `Dummy + 'static` cannot be shared between threads safely [E0277]
26 fn box_object_with_no_bound_not_ok<'a>() {
27 assert_send::<Box<Dummy>>();
28 //~^ ERROR `Dummy` cannot be sent between threads safely
31 fn object_with_send_bound_ok() {
32 assert_send::<&'static (Dummy+Sync)>();
33 assert_send::<Box<Dummy+Send>>();