aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/canonical_paths1.rs
blob: 193e7b5b6980fb69a9b3a32f2888cb4bced5842b (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
// { dg-additional-options "-w -fdump-tree-gimple -frust-crate=example" }
struct Foo(i32);

trait TR {
    fn test(&self) -> i32;
}

mod A {
    impl ::Foo {
        pub fn test(self) {}
        // { dg-final { scan-tree-dump-times {example::A::<impl example::Foo>::test} 2 gimple } }
    }

    impl ::TR for ::Foo {
        fn test(&self) -> i32 {
            // { dg-final { scan-tree-dump-times {example::A::<impl example::Foo as example::TR>::test} 1 gimple } }
            self.0
        }
    }
}

pub fn test() {
    let a = Foo(123);
    a.test();
}