about summary refs log tree commit diff
path: root/tests/ui/methods/wrong-ambig-message.rs
blob: f88d77e259d689631808e4b4ad509dc02d1b03f3 (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
fn main() {
    trait Hello {
        fn name(&self) -> String;
    }

    #[derive(Debug)]
    struct Container2 {
        val: String,
    }

    trait AName2 {
        fn name(&self) -> String;
    }

    trait BName2 {
        fn name(&self, v: bool) -> String;
    }

    impl AName2 for Container2 {
        fn name(&self) -> String {
            "aname2".into()
        }
    }

    impl BName2 for Container2 {
        fn name(&self, _v: bool) -> String {
            "bname2".into()
        }
    }

    let c2 = Container2 { val: "abc".into() };
    println!("c2 = {:?}", c2.name());
    //~^ ERROR: multiple applicable items in scope
}