2019-07-27 00:54:25 +03:00
|
|
|
// run-pass
|
2020-03-27 21:56:19 +01:00
|
|
|
#![allow(unused_braces)]
|
2015-01-08 02:25:56 +01:00
|
|
|
|
2015-01-02 17:32:54 -05:00
|
|
|
fn test_generic<T, F>(expected: T, eq: F) where T: Clone, F: FnOnce(T, T) -> bool {
|
2013-07-02 12:47:32 -07:00
|
|
|
let actual: T = { expected.clone() };
|
2015-01-02 17:32:54 -05:00
|
|
|
assert!(eq(expected, actual));
|
2011-09-23 14:58:06 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn test_vec() {
|
2015-03-25 17:06:52 -07:00
|
|
|
fn compare_vec(v1: Box<isize>, v2: Box<isize>) -> bool { return v1 == v2; }
|
2021-08-25 02:39:40 +02:00
|
|
|
test_generic::<Box<isize>, _>(Box::new(1), compare_vec);
|
2011-09-23 14:58:06 -07:00
|
|
|
}
|
|
|
|
|
2013-02-01 19:43:17 -08:00
|
|
|
pub fn main() { test_vec(); }
|