// run-pass #![allow(unused_braces)] fn test_generic(expected: Box, eq: F) where T: Clone, F: FnOnce(Box, Box) -> bool { let actual: Box = { expected.clone() }; assert!(eq(expected, actual)); } fn test_box() { fn compare_box(b1: Box, b2: Box) -> bool { println!("{}", *b1); println!("{}", *b2); return *b1 == *b2; } test_generic::(Box::new(true), compare_box); } pub fn main() { test_box(); }