]> git.proxmox.com Git - rustc.git/blame - src/test/ui/traits/auxiliary/trait_default_method_xc_aux.rs
New upstream version 1.51.0+dfsg1
[rustc.git] / src / test / ui / traits / auxiliary / trait_default_method_xc_aux.rs
CommitLineData
c34b1796 1pub struct Something { pub x: isize }
970d7e83
LB
2
3pub trait A {
c34b1796
AL
4 fn f(&self) -> isize;
5 fn g(&self) -> isize { 10 }
6 fn h(&self) -> isize { 11 }
7 fn lurr(x: &Self, y: &Self) -> isize { x.g() + y.h() }
970d7e83
LB
8}
9
10
c34b1796
AL
11impl A for isize {
12 fn f(&self) -> isize { 10 }
970d7e83
LB
13}
14
1a4d82fc 15impl A for Something {
c34b1796 16 fn f(&self) -> isize { 10 }
1a4d82fc
JJ
17}
18
19pub trait B<T> {
970d7e83 20 fn thing<U>(&self, x: T, y: U) -> (T, U) { (x, y) }
1a4d82fc 21 fn staticthing<U>(_z: &Self, x: T, y: U) -> (T, U) { (x, y) }
970d7e83
LB
22}
23
c34b1796 24impl<T> B<T> for isize { }
1a4d82fc 25impl B<f64> for bool { }
970d7e83
LB
26
27
28
29pub trait TestEquality {
30 fn test_eq(&self, rhs: &Self) -> bool;
31 fn test_neq(&self, rhs: &Self) -> bool {
32 !self.test_eq(rhs)
33 }
34}
35
c34b1796
AL
36impl TestEquality for isize {
37 fn test_eq(&self, rhs: &isize) -> bool {
970d7e83
LB
38 *self == *rhs
39 }
40}