]> git.proxmox.com Git - rustc.git/blame - src/test/ui/traits/trait-inheritance-cross-trait-call.rs
New upstream version 1.51.0+dfsg1
[rustc.git] / src / test / ui / traits / trait-inheritance-cross-trait-call.rs
CommitLineData
b7449926 1// run-pass
0bf4aa26 2#![allow(dead_code)]
223e47cc 3
c34b1796
AL
4trait Foo { fn f(&self) -> isize; }
5trait Bar : Foo { fn g(&self) -> isize; }
223e47cc 6
c34b1796
AL
7struct A { x: isize }
8
9impl Foo for A { fn f(&self) -> isize { 10 } }
223e47cc
LB
10
11impl Bar for A {
12 // Testing that this impl can call the impl of Foo
c34b1796 13 fn g(&self) -> isize { self.f() }
223e47cc
LB
14}
15
16pub fn main() {
17 let a = &A { x: 3 };
970d7e83 18 assert_eq!(a.g(), 10);
223e47cc 19}