]>
git.proxmox.com Git - rustc.git/blob - tests/ui/traits/inheritance/overloading-xc-exe.rs
2 // aux-build:overloading_xc.rs
5 extern crate overloading_xc
;
6 use overloading_xc
::{MyNum, MyInt}
;
8 fn f
<T
:MyNum
>(x
: T
, y
: T
) -> (T
, T
, T
) {
9 return (x
.clone() + y
.clone(), x
.clone() - y
.clone(), x
* y
);
12 fn mi(v
: isize) -> MyInt { MyInt { val: v }
}
15 let (x
, y
) = (mi(3), mi(5));
16 let (a
, b
, c
) = f(x
, y
);
18 assert_eq
!(b
, mi(-2));
19 assert_eq
!(c
, mi(15));