]>
Commit | Line | Data |
---|---|---|
416331ca | 1 | // run-pass |
72b1a166 | 2 | #![allow(unused_braces)] |
1a4d82fc | 3 | #![feature(box_syntax)] |
223e47cc | 4 | |
1a4d82fc JJ |
5 | fn test_generic<T, F>(expected: Box<T>, eq: F) where T: Clone, F: FnOnce(Box<T>, Box<T>) -> bool { |
6 | let actual: Box<T> = { expected.clone() }; | |
7 | assert!(eq(expected, actual)); | |
223e47cc LB |
8 | } |
9 | ||
10 | fn test_box() { | |
1a4d82fc JJ |
11 | fn compare_box(b1: Box<bool>, b2: Box<bool>) -> bool { |
12 | println!("{}", *b1); | |
13 | println!("{}", *b2); | |
223e47cc LB |
14 | return *b1 == *b2; |
15 | } | |
1a4d82fc | 16 | test_generic::<bool, _>(box true, compare_box); |
223e47cc LB |
17 | } |
18 | ||
19 | pub fn main() { test_box(); } |