aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/compile/canonical_paths1.rs
blob: bd6f3b27547c1f60917d10f6f59d963a6e0dd50c (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
// { dg-additional-options "-w -fdump-tree-gimple -frust-crate=example" }
#[lang = "sized"]
pub trait Sized {}

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();
}