File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ r[panic.panic_handler]
2020## The ` panic_handler ` attribute
2121
2222r[ panic.panic_handler.intro]
23- The * ` panic_handler ` attribute* can be applied to a function to define the behavior of panics.
23+ The * ` panic_handler ` [ attribute] [ attributes ] * can be applied to a function to define the behavior of panics.
2424
2525> [ !EXAMPLE]
2626> Below is shown a ` panic_handler ` function that logs the panic message and then halts the thread.
@@ -58,8 +58,17 @@ The *`panic_handler` attribute* can be applied to a function to define the behav
5858> [!NOTE]
5959> The [`PanicInfo`] struct contains information about the location of the panic.
6060
61+ r[panic.panic_handler.syntax]
62+ The `panic_handler` attribute uses the [MetaWord] syntax and thus does not take any inputs.
63+
6164r[panic.panic_handler.allowed-positions]
62- The `panic_handler` attribute can only be applied to a function with signature `fn(&PanicInfo) -> !`.
65+ The `panic_handler` attribute may only be applied to a function with signature `fn(&PanicInfo) -> !`.
66+
67+ r[panic.panic_handler.duplicates]
68+ Duplicate instances of the `panic_handler` attribute on a function are ignored.
69+
70+ > [!NOTE]
71+ > `rustc` currently warns about unused duplicate `panic_handler` attributes.
6372
6473r[panic.panic_handler.unique]
6574There must be a single `panic_handler` function in the dependency graph.
You can’t perform that action at this time.
0 commit comments