]> git.lizzy.rs Git - rust.git/blobdiff - src/librustdoc/lint.rs
Rollup merge of #86776 - tmiasko:v0-skip-layout-query, r=petrochenkov
[rust.git] / src / librustdoc / lint.rs
index 1b79811d4b075d3bf004a5853f257924f0850d48..376c83b1a6ea8836e492b202c7bada77e79d4d46 100644 (file)
@@ -157,6 +157,18 @@ macro_rules! declare_rustdoc_lint {
     "detects URLs that are not hyperlinks"
 }
 
+declare_rustdoc_lint! {
+   /// The `invalid_rust_codeblocks` lint detects Rust code blocks in
+   /// documentation examples that are invalid (e.g. empty, not parsable as
+   /// Rust code). This is a `rustdoc` only lint, see the documentation in the
+   /// [rustdoc book].
+   ///
+   /// [rustdoc book]: ../../../rustdoc/lints.html#invalid_rust_codeblocks
+   INVALID_RUST_CODEBLOCKS,
+   Warn,
+   "codeblock could not be parsed as valid Rust or is empty"
+}
+
 crate static RUSTDOC_LINTS: Lazy<Vec<&'static Lint>> = Lazy::new(|| {
     vec![
         BROKEN_INTRA_DOC_LINKS,
@@ -164,6 +176,7 @@ macro_rules! declare_rustdoc_lint {
         MISSING_DOC_CODE_EXAMPLES,
         PRIVATE_DOC_TESTS,
         INVALID_CODEBLOCK_ATTRIBUTES,
+        INVALID_RUST_CODEBLOCKS,
         INVALID_HTML_TAGS,
         BARE_URLS,
         MISSING_CRATE_LEVEL_DOCS,