]> git.lizzy.rs Git - rust.git/blob - src/test/ui/binding/expr-match-generic-unique1.rs
Rollup merge of #104793 - nicholasbishop:bishop-add-efiapi, r=JohnTitor
[rust.git] / src / test / ui / binding / expr-match-generic-unique1.rs
1 // run-pass
2
3 fn test_generic<T: Clone, F>(expected: Box<T>, eq: F) where F: FnOnce(Box<T>, Box<T>) -> bool {
4     let actual: Box<T> = match true {
5         true => { expected.clone() },
6         _ => panic!("wat")
7     };
8     assert!(eq(expected, actual));
9 }
10
11 fn test_box() {
12     fn compare_box(b1: Box<bool>, b2: Box<bool>) -> bool {
13         return *b1 == *b2;
14     }
15     test_generic::<bool, _>(Box::new(true), compare_box);
16 }
17
18 pub fn main() { test_box(); }