about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorlcnr <rust@lcnr.de>2021-10-21 19:48:56 +0200
committerlcnr <rust@lcnr.de>2021-10-21 21:14:34 +0200
commit22e17989751427625f6187a0b7ec27d621ce8164 (patch)
tree2993d86eeef1bcb79b4787a52ee5b59d325c0d14 /compiler
parent00e5abe9b6f713b1d868f17694113a5d50d96c19 (diff)
downloadrust-22e17989751427625f6187a0b7ec27d621ce8164.tar.gz
rust-22e17989751427625f6187a0b7ec27d621ce8164.zip
ignore `potential_query_instability` in rustdoc
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_lint/src/internal.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/rustc_lint/src/internal.rs b/compiler/rustc_lint/src/internal.rs
index 93823aca8ec..e9dcc120200 100644
--- a/compiler/rustc_lint/src/internal.rs
+++ b/compiler/rustc_lint/src/internal.rs
@@ -59,6 +59,21 @@ declare_lint_pass!(QueryStability => [POTENTIAL_QUERY_INSTABILITY]);
 
 impl LateLintPass<'_> for QueryStability {
     fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
+        // FIXME(rustdoc): This lint uses typecheck results, causing rustdoc to
+        // error if there are resolution failures.
+        //
+        // As internal lints are currently always run if there are `unstable_options`,
+        // they are added to the lint store of rustdoc. Internal lints are also
+        // not used via the `lint_mod` query. Crate lints run outside of a query
+        // so rustdoc currently doesn't disable them.
+        //
+        // Instead of relying on this, either change crate lints to a query disabled by
+        // rustdoc, only run internal lints if the user is explicitly opting in
+        // or figure out a different way to avoid running lints for rustdoc.
+        if cx.tcx.sess.opts.actually_rustdoc {
+            return;
+        }
+
         let (def_id, span) = match expr.kind {
             ExprKind::Path(ref path) if let Some(def_id) = cx.qpath_res(path, expr.hir_id).opt_def_id() => {
                 (def_id, expr.span)