Skip to content

Commit

Permalink
docs: rust: clarify panicking
Browse files Browse the repository at this point in the history
Link: https://lore.kernel.org/lkml/CAKwvOdmXNAm+TcypR0dCayp9bJ7RFcgLx5sB8_2MfzO31T3PJg@mail.gmail.com/
Suggested-by: Nick Desaulniers <ndesaulniers@google.com>
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
  • Loading branch information
ojeda committed Jul 2, 2021
1 parent 0a4d8cd commit f97e06f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Documentation/rust/docs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ This example showcases a few ``rustdoc`` features and some common conventions
safe under a ``Safety`` section.

* While not shown here, if a function may panic, the conditions under which
that happens must be described under a ``Panics`` section.
that happens must be described under a ``Panics`` section. Please note that
panicking should be very rare and used only with a good reason. In almost
all cases, you should use a fallible approach, returning a `Result`.

* If providing examples of usage would help readers, they must be written in
a section called ``Examples``.
Expand Down

0 comments on commit f97e06f

Please sign in to comment.