File tree 2 files changed +65
-1
lines changed 2 files changed +65
-1
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,18 @@ pub fn unreachable_and_panic() {
33
33
if true { unreachable ! ( ) } else { panic ! ( ) }
34
34
}
35
35
36
+ /// This needs to be documented
37
+ pub fn assert_eq ( ) {
38
+ let x = 0 ;
39
+ assert_eq ! ( x, 0 ) ;
40
+ }
41
+
42
+ /// This needs to be documented
43
+ pub fn assert_ne ( ) {
44
+ let x = 0 ;
45
+ assert_ne ! ( x, 0 ) ;
46
+ }
47
+
36
48
/// This is documented
37
49
///
38
50
/// # Panics
@@ -83,6 +95,26 @@ pub fn unreachable_amd_panic_documented() {
83
95
if true { unreachable ! ( ) } else { panic ! ( ) }
84
96
}
85
97
98
+ /// This is documented
99
+ ///
100
+ /// # Panics
101
+ ///
102
+ /// Panics if `x` is not 0.
103
+ pub fn assert_eq_documented ( ) {
104
+ let x = 0 ;
105
+ assert_eq ! ( x, 0 ) ;
106
+ }
107
+
108
+ /// This is documented
109
+ ///
110
+ /// # Panics
111
+ ///
112
+ /// Panics if `x` is 0.
113
+ pub fn assert_ne_documented ( ) {
114
+ let x = 0 ;
115
+ assert_ne ! ( x, 0 ) ;
116
+ }
117
+
86
118
/// This is okay because it is private
87
119
fn unwrap_private ( ) {
88
120
let result = Err ( "Hi" ) ;
Original file line number Diff line number Diff line change @@ -78,5 +78,37 @@ LL | if true { unreachable!() } else { panic!() }
78
78
| ^^^^^^^^
79
79
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
80
80
81
- error: aborting due to 5 previous errors
81
+ error: docs for function which may panic missing `# Panics` section
82
+ --> $DIR/missing_panics_doc.rs:37:1
83
+ |
84
+ LL | / pub fn assert_eq() {
85
+ LL | | let x = 0;
86
+ LL | | assert_eq!(x, 0);
87
+ LL | | }
88
+ | |_^
89
+ |
90
+ note: first possible panic found here
91
+ --> $DIR/missing_panics_doc.rs:39:5
92
+ |
93
+ LL | assert_eq!(x, 0);
94
+ | ^^^^^^^^^^^^^^^^^
95
+ = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
96
+
97
+ error: docs for function which may panic missing `# Panics` section
98
+ --> $DIR/missing_panics_doc.rs:43:1
99
+ |
100
+ LL | / pub fn assert_ne() {
101
+ LL | | let x = 0;
102
+ LL | | assert_ne!(x, 0);
103
+ LL | | }
104
+ | |_^
105
+ |
106
+ note: first possible panic found here
107
+ --> $DIR/missing_panics_doc.rs:45:5
108
+ |
109
+ LL | assert_ne!(x, 0);
110
+ | ^^^^^^^^^^^^^^^^^
111
+ = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
112
+
113
+ error: aborting due to 7 previous errors
82
114
You can’t perform that action at this time.
0 commit comments