1818//! * No CR characters
1919//! * No `TODO` or `XXX` directives
2020//! * A valid license header is at the top
21+ //! * No unexplained ` ```ignore ` or ` ```rust,ignore ` doc tests
2122//!
2223//! A number of these checks can be opted-out of with various directives like
2324//! `// ignore-tidy-linelength`.
@@ -38,6 +39,17 @@ http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
3839option. This file may not be copied, modified, or distributed
3940except according to those terms." ;
4041
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+
4153/// Parser states for line_is_url.
4254#[ derive( PartialEq ) ]
4355#[ allow( non_camel_case_types) ]
@@ -141,6 +153,9 @@ pub fn check(path: &Path, bad: &mut bool) {
141153 err ( "XXX is deprecated; use FIXME" )
142154 }
143155 }
156+ if line. ends_with ( "```ignore" ) || line. ends_with ( "```rust,ignore" ) {
157+ err ( UNEXPLAINED_IGNORE_DOCTEST_INFO ) ;
158+ }
144159 }
145160 if !licenseck ( file, & contents) {
146161 tidy_error ! ( bad, "{}: incorrect license" , file. display( ) ) ;
0 commit comments