]> git.lizzy.rs Git - rust.git/blob - tests/ui/expr-block-generic-unique1.rs
Rollup merge of #107234 - Rattenkrieg:bootstrap-fix-is_ci_llvm_available, r=albertlar...
[rust.git] / tests / ui / expr-block-generic-unique1.rs
1 // run-pass
2 #![allow(unused_braces)]
3
4 fn test_generic<T, F>(expected: Box<T>, eq: F) where T: Clone, F: FnOnce(Box<T>, Box<T>) -> bool {
5     let actual: Box<T> = { expected.clone() };
6     assert!(eq(expected, actual));
7 }
8
9 fn test_box() {
10     fn compare_box(b1: Box<bool>, b2: Box<bool>) -> bool {
11         println!("{}", *b1);
12         println!("{}", *b2);
13         return *b1 == *b2;
14     }
15     test_generic::<bool, _>(Box::new(true), compare_box);
16 }
17
18 pub fn main() { test_box(); }