From 634bf34993d98841ab7098a5b3df8977686a950e Mon Sep 17 00:00:00 2001 From: Aaron Hill Date: Wed, 29 May 2019 23:08:04 -0400 Subject: [PATCH] Add additional indirection to test --- tests/run-pass/catch_panic.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/run-pass/catch_panic.rs b/tests/run-pass/catch_panic.rs index e3e0de7964..c36bed2bcd 100644 --- a/tests/run-pass/catch_panic.rs +++ b/tests/run-pass/catch_panic.rs @@ -41,7 +41,10 @@ fn main() { std::panic::set_hook(Box::new(|_panic_info| { HOOK_CALLED.with(|h| h.set(true)); })); - let res = catch_unwind(do_panic_counter); + let res = catch_unwind(|| { + let _string = "LEAKED FROM CLOSURE".to_string(); + do_panic_counter() + }); let expected: Box = Box::new("Hello from panic: 0".to_string()); let actual = res.expect_err("do_panic() did not panic!") .downcast::().expect("Failed to cast to string!");