about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/doc/missing_panics_doc.stderr75
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/ui/doc/missing_panics_doc.stderr b/tests/ui/doc/missing_panics_doc.stderr
new file mode 100644
index 00000000000..f3e613bc799
--- /dev/null
+++ b/tests/ui/doc/missing_panics_doc.stderr
@@ -0,0 +1,75 @@
+error: docs for function which may panic missing `# Panics` section
+  --> $DIR/missing_panics_doc.rs:3:1
+   |
+LL | pub fn option_unwrap<T>(v: &[T]) -> &T {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: first possible panic found here
+  --> $DIR/missing_panics_doc.rs:5:5
+   |
+LL |     o.unwrap()
+   |     ^^^^^^^^^^
+   = note: `-D clippy::missing-panics-doc` implied by `-D warnings`
+
+error: docs for function which may panic missing `# Panics` section
+  --> $DIR/missing_panics_doc.rs:8:1
+   |
+LL | pub fn option_expect<T>(v: &[T]) -> &T {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: first possible panic found here
+  --> $DIR/missing_panics_doc.rs:10:5
+   |
+LL |     o.expect("passed an empty thing")
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: docs for function which may panic missing `# Panics` section
+  --> $DIR/missing_panics_doc.rs:13:1
+   |
+LL | pub fn result_unwrap<T>(v: &[T]) -> &T {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: first possible panic found here
+  --> $DIR/missing_panics_doc.rs:15:5
+   |
+LL |     res.unwrap()
+   |     ^^^^^^^^^^^^
+
+error: docs for function which may panic missing `# Panics` section
+  --> $DIR/missing_panics_doc.rs:18:1
+   |
+LL | pub fn result_expect<T>(v: &[T]) -> &T {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: first possible panic found here
+  --> $DIR/missing_panics_doc.rs:20:5
+   |
+LL |     res.expect("passed an empty thing")
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: docs for function which may panic missing `# Panics` section
+  --> $DIR/missing_panics_doc.rs:23:1
+   |
+LL | pub fn last_unwrap(v: &[u32]) -> u32 {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: first possible panic found here
+  --> $DIR/missing_panics_doc.rs:24:6
+   |
+LL |     *v.last().unwrap()
+   |      ^^^^^^^^^^^^^^^^^
+
+error: docs for function which may panic missing `# Panics` section
+  --> $DIR/missing_panics_doc.rs:27:1
+   |
+LL | pub fn last_expect(v: &[u32]) -> u32 {
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   |
+note: first possible panic found here
+  --> $DIR/missing_panics_doc.rs:28:6
+   |
+LL |     *v.last().expect("passed an empty thing")
+   |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: aborting due to 6 previous errors
+