We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5aa0f5c commit b909669Copy full SHA for b909669
tests/run-pass/catch_panic.rs
@@ -41,7 +41,10 @@ fn main() {
41
std::panic::set_hook(Box::new(|_panic_info| {
42
HOOK_CALLED.with(|h| h.set(true));
43
}));
44
- let res = catch_unwind(do_panic_counter);
+ let res = catch_unwind(|| {
45
+ let _string = "LEAKED FROM CLOSURE".to_string();
46
+ do_panic_counter()
47
+ });
48
let expected: Box<String> = Box::new("Hello from panic: 0".to_string());
49
let actual = res.expect_err("do_panic() did not panic!")
50
.downcast::<String>().expect("Failed to cast to string!");
0 commit comments