about summary refs log tree commit diff
path: root/src/librustdoc
diff options
context:
space:
mode:
authorDennis Hamester <dennis.hamester@gmail.com>2020-07-22 19:53:43 +0200
committerDennis Hamester <dennis.hamester@gmail.com>2020-07-22 21:40:51 +0200
commitc14641a814696f6dffe5a0e7d693af31a4e40d09 (patch)
tree86aecba96300b9b009e0efbad1cf6bfc04bcb436 /src/librustdoc
parented53de029cf84651423007ec68305d6e772c819f (diff)
rustdoc: Add explanation when linting against public to private item links
The additional note helps explaining why the lint was triggered and that
--document-private-items directly influences the link resolution.
Diffstat (limited to 'src/librustdoc')
-rw-r--r--src/librustdoc/passes/collect_intra_doc_links.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs
index 8e113cfa563..5187839423d 100644
--- a/src/librustdoc/passes/collect_intra_doc_links.rs
+++ b/src/librustdoc/passes/collect_intra_doc_links.rs
@@ -1076,6 +1076,13 @@ fn privacy_error(
         if let Some(sp) = sp {
             diag.span_label(sp, "this item is private");
         }
+
+        let note_msg = if cx.render_options.document_private {
+            "this link resolves only because you passed `--document-private-items`, but will break without"
+        } else {
+            "this link will resolve properly if you pass `--document-private-items`"
+        };
+        diag.note(note_msg);
     });
 }