Debian Codegraph @

gcc/testsuite/rust/compile/canonical_paths1.rs

raw
1 // { dg-additional-options "-w -fdump-tree-gimple -frust-crate=example" }
2 #[lang = "sized"]
3 pub trait Sized {}
4
5 struct Foo(i32);
6
7 trait TR {
8 fn test(&self) -> i32;
9 }
10
11 mod A {
12 impl ::Foo {
13 pub fn test(self) {}
14 // { dg-final { scan-tree-dump-times {example::A::<impl example::Foo>::test} 2 gimple } }
15 }
16
17 impl ::TR for ::Foo {
18 fn test(&self) -> i32 {
19 // { dg-final { scan-tree-dump-times {example::A::<impl example::Foo as example::TR>::test} 1 gimple } }
20 self.0
21 }
22 }
23 }
24
25 pub fn test() {
26 let a = Foo(123);
27 a.test();
28 }