]> git.proxmox.com Git - rustc.git/blob - tests/ui/traits/inheritance/overloading-xc-exe.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / traits / inheritance / overloading-xc-exe.rs
1 // run-pass
2 // aux-build:overloading_xc.rs
3
4
5 extern crate overloading_xc;
6 use overloading_xc::{MyNum, MyInt};
7
8 fn f<T:MyNum>(x: T, y: T) -> (T, T, T) {
9 return (x.clone() + y.clone(), x.clone() - y.clone(), x * y);
10 }
11
12 fn mi(v: isize) -> MyInt { MyInt { val: v } }
13
14 pub fn main() {
15 let (x, y) = (mi(3), mi(5));
16 let (a, b, c) = f(x, y);
17 assert_eq!(a, mi(8));
18 assert_eq!(b, mi(-2));
19 assert_eq!(c, mi(15));
20 }