about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-12-27 01:21:40 +0000
committerbors <bors@rust-lang.org>2020-12-27 01:21:40 +0000
commit7e0246552facb87995fb2ee6b211b9ffd05b4c62 (patch)
tree411087a6996fffb4e69487abd0c78eee03cea877
parent0fbc0ce3ab75237c4f65022bdb1f8673811dc858 (diff)
parent966621563e40f262b3e14d1ff785d97937ddf1ef (diff)
downloadrust-7e0246552facb87995fb2ee6b211b9ffd05b4c62.tar.gz
rust-7e0246552facb87995fb2ee6b211b9ffd05b4c62.zip
Auto merge of #80395 - ehuss:lint-docs-warn-missing, r=Mark-Simulacrum
lint-docs: Warn on missing lint when documenting.

In #79522, I missed converting one of the errors to a warning, in the situation where a lint is missing.  This was unearthed by the renaming of overlapping-patterns (#78242).  This will still be validated during the test phase.
-rw-r--r--src/tools/lint-docs/src/groups.rs22
1 files changed, 16 insertions, 6 deletions
diff --git a/src/tools/lint-docs/src/groups.rs b/src/tools/lint-docs/src/groups.rs
index 0a69b18a332..e8fd19a6381 100644
--- a/src/tools/lint-docs/src/groups.rs
+++ b/src/tools/lint-docs/src/groups.rs
@@ -116,13 +116,23 @@ impl<'a> LintExtractor<'a> {
         result.push('\n');
         result.push_str("[warn-by-default]: listing/warn-by-default.md\n");
         for lint_name in to_link {
-            let lint_def =
-                lints.iter().find(|l| l.name == lint_name.replace("-", "_")).ok_or_else(|| {
-                    format!(
-                        "`rustc -W help` defined lint `{}` but that lint does not appear to exist",
+            let lint_def = match lints.iter().find(|l| l.name == lint_name.replace("-", "_")) {
+                Some(def) => def,
+                None => {
+                    let msg = format!(
+                        "`rustc -W help` defined lint `{}` but that lint does not \
+                        appear to exist\n\
+                        Check that the lint definition includes the appropriate doc comments.",
                         lint_name
-                    )
-                })?;
+                    );
+                    if self.validate {
+                        return Err(msg.into());
+                    } else {
+                        eprintln!("warning: {}", msg);
+                        continue;
+                    }
+                }
+            };
             write!(
                 result,
                 "[{}]: listing/{}#{}\n",