aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/auto_traits2.rs
blob: 7d0dcc11cd2a2eb16d68c5509eacb2ba5fb253d3 (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
25
26
#![feature(optin_builtin_traits)]

pub unsafe auto trait Send {}
#[lang = "sync"]
pub unsafe auto trait Sync {}

trait A {
    fn a_method(&self) {}
}

fn foo(a: &(dyn A + Send + Sync)) {
    a.a_method();
}

struct S;

impl A for S {
    fn a_method(&self) {}
}

fn main() {
    let s = S;

    foo(&s); // { dg-error "bounds not satisfied" }
             // { dg-error "mismatched type" "" { target *-*-* } .-1 }
}