1 // run-pass
2 trait Foo {
f(&self)3     fn f(&self);
4 }
5 
6 struct Bar {
7     x: isize
8 }
9 
10 trait Baz {
g(&self)11     fn g(&self);
12 }
13 
14 impl<T:Baz> Foo for T {
f(&self)15     fn f(&self) {
16         self.g();
17     }
18 }
19 
20 impl Baz for Bar {
g(&self)21     fn g(&self) {
22         println!("{}", self.x);
23     }
24 }
25 
main()26 pub fn main() {
27     let y = Bar { x: 42 };
28     y.f();
29 }
30