18
18
//! * No CR characters
19
19
//! * No `TODO` or `XXX` directives
20
20
//! * A valid license header is at the top
21
+ //! * No unexplained ` ```ignore ` or ` ```rust,ignore ` doc tests
21
22
//!
22
23
//! A number of these checks can be opted-out of with various directives like
23
24
//! `// ignore-tidy-linelength`.
@@ -38,6 +39,17 @@ http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
38
39
option. This file may not be copied, modified, or distributed
39
40
except according to those terms." ;
40
41
42
+ const UNEXPLAINED_IGNORE_DOCTEST_INFO : & str = r#"unexplained "```ignore" doctest; try one:
43
+
44
+ * make the test actually pass, by adding necessary imports and declarations, or
45
+ * use "```text", if the code is not Rust code, or
46
+ * use "```compile_fail,Ennnn", if the code is expected to fail at compile time, or
47
+ * use "```should_panic", if the code is expected to fail at run time, or
48
+ * use "```no_run", if the code should type-check but not necessary linkable/runnable, or
49
+ * explain it like "```ignore (cannot-test-this-because-xxxx)", if the annotation cannot be avoided.
50
+
51
+ "# ;
52
+
41
53
/// Parser states for line_is_url.
42
54
#[ derive( PartialEq ) ]
43
55
#[ allow( non_camel_case_types) ]
@@ -138,6 +150,9 @@ pub fn check(path: &Path, bad: &mut bool) {
138
150
err ( "XXX is deprecated; use FIXME" )
139
151
}
140
152
}
153
+ if line. ends_with ( "```ignore" ) || line. ends_with ( "```rust,ignore" ) {
154
+ err ( UNEXPLAINED_IGNORE_DOCTEST_INFO ) ;
155
+ }
141
156
}
142
157
if !licenseck ( file, & contents) {
143
158
tidy_error ! ( bad, "{}: incorrect license" , file. display( ) ) ;
0 commit comments