From f97e06fe5a45535538422cac7406653d69f9dc89 Mon Sep 17 00:00:00 2001 From: Miguel Ojeda Date: Fri, 2 Jul 2021 21:50:23 +0200 Subject: [PATCH] docs: rust: clarify panicking Link: https://lore.kernel.org/lkml/CAKwvOdmXNAm+TcypR0dCayp9bJ7RFcgLx5sB8_2MfzO31T3PJg@mail.gmail.com/ Suggested-by: Nick Desaulniers Signed-off-by: Miguel Ojeda --- Documentation/rust/docs.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Documentation/rust/docs.rst b/Documentation/rust/docs.rst index 76c4be5db595ab..ab29d8b6a00df3 100644 --- a/Documentation/rust/docs.rst +++ b/Documentation/rust/docs.rst @@ -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``.