]>
Commit | Line | Data |
---|---|---|
1a4d82fc JJ |
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. | |
4 | // | |
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. | |
10 | ||
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` | |
14 | ||
15 | fn assert_send<T:Send>() { } | |
9346a6ac | 16 | trait Dummy { } |
1a4d82fc JJ |
17 | trait Message : Send { } |
18 | ||
19 | // careful with object types, who knows what they close over... | |
20 | ||
21 | fn object_ref_with_static_bound_not_ok() { | |
22 | assert_send::<&'static (Dummy+'static)>(); | |
54a0048b | 23 | //~^ ERROR : std::marker::Sync` is not satisfied |
1a4d82fc JJ |
24 | } |
25 | ||
26 | fn box_object_with_no_bound_not_ok<'a>() { | |
54a0048b | 27 | assert_send::<Box<Dummy>>(); //~ ERROR : std::marker::Send` is not satisfied |
1a4d82fc JJ |
28 | } |
29 | ||
30 | fn object_with_send_bound_ok() { | |
85aaf69f | 31 | assert_send::<&'static (Dummy+Sync)>(); |
1a4d82fc JJ |
32 | assert_send::<Box<Dummy+Send>>(); |
33 | } | |
34 | ||
35 | fn main() { } |