about summary refs log tree commit diff
path: root/tests/ui/impl-trait/in-trait/rpitit-duplicate-associated-fn.rs
blob: 6db0c88f6c00529ff4d1b64319bfe733eecad638 (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
// issue#140796

trait Bar {
    fn method() -> impl Sized;
    fn method() -> impl Sized;  //~ ERROR: the name `method` is defined multiple times
}

impl Bar for () {               //~ ERROR: not all trait items implemented, missing: `method`
    fn method() -> impl Sized {
        42
    }
    fn method() -> impl Sized { //~ ERROR: duplicate definitions with name `method`
        42
    }
}

trait T {
    fn method() -> impl Sized;
}

impl T for () {
    fn method() -> impl Sized {
        42
    }
    fn method() -> impl Sized { //~ ERROR: duplicate definitions with name `method`
        42
    }
}

trait Baz {
    fn foo();
    fn foo() -> impl Sized;     //~ ERROR: the name `foo` is defined multiple times
}

trait Foo {
    fn foo() -> impl Sized;
    fn foo();                   //~ ERROR: the name `foo` is defined multiple times
    fn foo() -> impl Sized;     //~ ERROR: the name `foo` is defined multiple times
}

fn main() {}