summaryrefslogtreecommitdiffstats
path: root/tests/ui/traits/issue-33140.rs
blob: 9bdac4b8375c265bdcb41f1b3c5f9a1a2fdbdeb9 (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
trait Trait {
    fn xyz() -> bool;
}

impl Trait for dyn Send + Sync {
    fn xyz() -> bool { false }
}

impl Trait for dyn Sync + Send {
//~^ ERROR conflicting implementations
    fn xyz() -> bool { true }
}

trait Trait2 {
    fn uvw() -> bool;
}

impl Trait2 for dyn Send + Sync {
    fn uvw() -> bool { false }
}

impl Trait2 for dyn Sync + Send + Sync {
//~^ ERROR conflicting implementations
    fn uvw() -> bool { true }
}

struct Foo<T: ?Sized>(T);
impl Foo<dyn Send + Sync> {
    fn abc() -> bool { //~ ERROR duplicate definitions with name `abc`
        false
    }
}

impl Foo<dyn Sync + Send> {
    fn abc() -> bool {
        true
    }
}

fn main() {
    assert_eq!(<dyn Send + Sync>::xyz(), false);
    assert_eq!(<dyn Sync + Send>::xyz(), true);
    assert_eq!(<dyn Send + Sync>::uvw(), false);
    assert_eq!(<dyn Sync + Send+ Sync>::uvw(), true);
    assert_eq!(<Foo<dyn Send + Sync>>::abc(), false);
    assert_eq!(<Foo<dyn Sync + Send>>::abc(), true);
}