Skip to content

Commit b909669

Browse files
committed
Add additional indirection to test
1 parent 5aa0f5c commit b909669

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/run-pass/catch_panic.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ fn main() {
4141
std::panic::set_hook(Box::new(|_panic_info| {
4242
HOOK_CALLED.with(|h| h.set(true));
4343
}));
44-
let res = catch_unwind(do_panic_counter);
44+
let res = catch_unwind(|| {
45+
let _string = "LEAKED FROM CLOSURE".to_string();
46+
do_panic_counter()
47+
});
4548
let expected: Box<String> = Box::new("Hello from panic: 0".to_string());
4649
let actual = res.expect_err("do_panic() did not panic!")
4750
.downcast::<String>().expect("Failed to cast to string!");

0 commit comments

Comments
 (0)