Skip to content

Commit 3f552fe

Browse files
committed
test calling Box<dyn FnOnce>
1 parent 5c5cc2a commit 3f552fe

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

tests/run-pass/closures.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,14 @@ fn fn_once_closure_with_multiple_args() -> i64 {
4040
}
4141
}
4242

43+
fn boxed(f: Box<dyn FnOnce() -> i32>) -> i32 {
44+
f()
45+
}
46+
4347
fn main() {
4448
assert_eq!(simple(), 12);
4549
assert_eq!(crazy_closure(), (84, 10, 10));
4650
assert_eq!(closure_arg_adjustment_problem(), 3);
4751
assert_eq!(fn_once_closure_with_multiple_args(), 6);
52+
assert_eq!(boxed(Box::new({let x = 13; move || x})), 13);
4853
}

0 commit comments

Comments
 (0)