File tree 2 files changed +42
-1
lines changed
2 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,15 @@ pub fn inner_body(opt: Option<u32>) {
28
28
} ) ;
29
29
}
30
30
31
+ /// This needs to be documented
32
+ pub fn unreachable_and_panic ( ) {
33
+ if true {
34
+ unreachable ! ( )
35
+ } else {
36
+ panic ! ( )
37
+ }
38
+ }
39
+
31
40
/// This is documented
32
41
///
33
42
/// # Panics
@@ -69,6 +78,19 @@ pub fn todo_documented() {
69
78
todo ! ( )
70
79
}
71
80
81
+ /// This is documented
82
+ ///
83
+ /// # Panics
84
+ ///
85
+ /// We still need to do this part
86
+ pub fn unreachable_amd_panic_documented ( ) {
87
+ if true {
88
+ unreachable ! ( )
89
+ } else {
90
+ panic ! ( )
91
+ }
92
+ }
93
+
72
94
/// This is okay because it is private
73
95
fn unwrap_private ( ) {
74
96
let result = Err ( "Hi" ) ;
Original file line number Diff line number Diff line change @@ -63,5 +63,24 @@ LL | panic!()
63
63
| ^^^^^^^^
64
64
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
65
65
66
- error: aborting due to 4 previous errors
66
+ error: docs for function which may panic missing `# Panics` section
67
+ --> $DIR/doc_panics.rs:32:1
68
+ |
69
+ LL | / pub fn unreachable_and_panic() {
70
+ LL | | if true {
71
+ LL | | unreachable!()
72
+ LL | | } else {
73
+ LL | | panic!()
74
+ LL | | }
75
+ LL | | }
76
+ | |_^
77
+ |
78
+ note: first possible panic found here
79
+ --> $DIR/doc_panics.rs:36:9
80
+ |
81
+ LL | panic!()
82
+ | ^^^^^^^^
83
+ = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
84
+
85
+ error: aborting due to 5 previous errors
67
86
You can’t perform that action at this time.
0 commit comments