// run-pass fn test_generic(expected: Box, eq: F) where F: FnOnce(Box, Box) -> bool { let actual: Box = match true { true => { expected.clone() }, _ => panic!("wat") }; assert!(eq(expected, actual)); } fn test_box() { fn compare_box(b1: Box, b2: Box) -> bool { return *b1 == *b2; } test_generic::(Box::new(true), compare_box); } pub fn main() { test_box(); }