rust/tests/ui/box/unit/expr-block-generic-unique2.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

15 lines
392 B
Rust
Raw Normal View History

// run-pass
2020-03-27 15:56:19 -05:00
#![allow(unused_braces)]
2015-01-02 16:32:54 -06:00
fn test_generic<T, F>(expected: T, eq: F) where T: Clone, F: FnOnce(T, T) -> bool {
2013-07-02 14:47:32 -05:00
let actual: T = { expected.clone() };
2015-01-02 16:32:54 -06:00
assert!(eq(expected, actual));
}
fn test_vec() {
fn compare_vec(v1: Box<isize>, v2: Box<isize>) -> bool { return v1 == v2; }
test_generic::<Box<isize>, _>(Box::new(1), compare_vec);
}
pub fn main() { test_vec(); }