Skip to content

Commit 871692a

Browse files
Rollup merge of #148378 - ilai-deutel:update_hook-doc, r=joboet
Fix documentation for std::panic::update_hook The equivalent code given in the documentation of `std::panic::update_hook`[^1] does not compile: * `set_hook` expects a boxed function * Missing closing delimiter for the closure [^1]: #92649
2 parents 786d828 + b9e127a commit 871692a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

library/std/src/panicking.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ pub fn take_hook() -> Box<dyn Fn(&PanicHookInfo<'_>) + 'static + Sync + Send> {
215215
///
216216
/// // Equivalent to
217217
/// // let prev = panic::take_hook();
218-
/// // panic::set_hook(move |info| {
218+
/// // panic::set_hook(Box::new(move |info| {
219219
/// // println!("...");
220220
/// // prev(info);
221-
/// // );
221+
/// // }));
222222
/// panic::update_hook(move |prev, info| {
223223
/// println!("Print custom message and execute panic handler as usual");
224224
/// prev(info);

0 commit comments

Comments
 (0)