Debian Codegraph @

gcc/testsuite/rust/compile/traits8.rs

raw
1 #[lang = "sized"]
2 pub trait Sized {}
3
4 trait A {
5 fn get(self) -> f64;
6 }
7
8 trait B {
9 fn get(self) -> u8;
10 }
11
12 struct Foo(u8, f64);
13
14 impl A for Foo {
15 fn get(self) -> f64 {
16 self.1
17 }
18 }
19
20 impl B for Foo {
21 fn get(self) -> u8 {
22 self.0
23 }
24 }
25
26 fn main() {
27 let _a;
28 _a = Foo(123, 456f64);
29
30 let _b: f64;
31 _b = <Foo as A>::get(_a);
32
33 let _a;
34 _a = Foo(123, 456f64);
35
36 let _c: u8;
37 _c = <Foo as B>::get(_a)
38 }