summaryrefslogtreecommitdiffstats
path: root/tests/ui/kindck/kindck-send-object2.rs
blob: b797588e446d635f17d4b3e18f62f8680b014f52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Continue kindck-send-object1.rs.

fn assert_send<T:Send>() { }
trait Dummy { }

fn test50() {
    assert_send::<&'static dyn Dummy>();
    //~^ ERROR `(dyn Dummy + 'static)` cannot be shared between threads safely [E0277]
}

fn test53() {
    assert_send::<Box<dyn Dummy>>();
    //~^ ERROR `dyn Dummy` cannot be sent between threads safely
}

// ...unless they are properly bounded
fn test60() {
    assert_send::<&'static (dyn Dummy + Sync)>();
}
fn test61() {
    assert_send::<Box<dyn Dummy + Send>>();
}

fn main() { }